home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / usenet / sources / volume91 / libraris / sregexp9 / part01 next >
Encoding:
Internet Message Format  |  1991-05-18  |  72.3 KB

  1. Path: news.larc.nasa.gov!amiga-request
  2. From: amiga-request@ab20.larc.nasa.gov (Amiga Sources/Binaries Moderator)
  3. Subject: v91i107: sregexp.library 9.4 - a library for regular expressions, Part01/02
  4. Reply-To: "J. Spencer" <bhgs@utcs.utoronto.ca>
  5. Newsgroups: comp.sources.amiga
  6. Message-ID: <comp.sources.amiga:v91i107@ab20.larc.nasa.gov>
  7. Date: 18 May 91 01:57:00 GMT
  8. Approved: tadguy@uunet.UU.NET (Tad Guy)
  9. X-Mail-Submissions-To: amiga@uunet.uu.net
  10. X-Post-Discussions-To: comp.sys.amiga.misc
  11.  
  12. Submitted-by: "J. Spencer" <bhgs@utcs.utoronto.ca>
  13. Posting-number: Volume 91, Issue 107
  14. Archive-name: libraries/sregexp-9.4/part01
  15.  
  16. [ includes uuencoded libraries  ...tad ]
  17.  
  18. 'sregexp.library' is a run time library of routines for doing wildcard
  19. pattern matching and wildcard path matching.  It accepts a slight extension
  20. of the AmigaDOS wildcard syntax, including a not operator, and character
  21. sets. It has routines to test if a string matches a wildcard expression,
  22. and for scanning through all matches to a wildcarded AmigaDOS path.  There
  23. are two nifty features to the path matching routines: '.../' means
  24. recursively scan all subdirectories, and may come anywhere in the path; and
  25. wildcards are allowed in the volume node part of the path! (DH?: would
  26. match all your hard drive partitions.)
  27.  
  28. #!/bin/sh
  29. # This is a shell archive.  Remove anything before this line, then unpack
  30. # it by saving it into a file and typing "sh file".  To overwrite existing
  31. # files, type "sh file -c".  You can also feed this as standard input via
  32. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  33. # will see the following message at the end:
  34. #        "End of archive 1 (of 2)."
  35. # Contents:  BUGS_TO COPYRIGHT.NOTICE OVERVIEW clibrary.asm
  36. #   compilation.notes dmakefile instillation.notes kludge.asm
  37. #   revision.history spath.c sreg_version.c sreg_version.i sregexp.fd
  38. #   sregexp.h sregexp.uu sregexp_protos.h sregexpbase.h sregexpbase.i
  39. #   sregexps.uu sregexpsr.uu utils utils/bumprev.c utils/remlib.c
  40. #   utils/try.c
  41. # Wrapped by tadguy@ab20 on Fri May 17 21:56:58 1991
  42. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  43. if test -f 'BUGS_TO' -a "${1}" != "-c" ; then 
  44.   echo shar: Will not clobber existing file \"'BUGS_TO'\"
  45. else
  46. echo shar: Extracting \"'BUGS_TO'\" \(94 characters\)
  47. sed "s/^X//" >'BUGS_TO' <<'END_OF_FILE'
  48. X
  49. XSend bug reports, comments, etc. to
  50. X
  51. X    Jon Spencer.
  52. X
  53. X    EMail:    bhgs@gpu.utcs.utoronto.ca
  54. X
  55. END_OF_FILE
  56. if test 94 -ne `wc -c <'BUGS_TO'`; then
  57.     echo shar: \"'BUGS_TO'\" unpacked with wrong size!
  58. fi
  59. # end of 'BUGS_TO'
  60. fi
  61. if test -f 'COPYRIGHT.NOTICE' -a "${1}" != "-c" ; then 
  62.   echo shar: Will not clobber existing file \"'COPYRIGHT.NOTICE'\"
  63. else
  64. echo shar: Extracting \"'COPYRIGHT.NOTICE'\" \(1083 characters\)
  65. sed "s/^X//" >'COPYRIGHT.NOTICE' <<'END_OF_FILE'
  66. X
  67. X    The library 'sregexp.library', and all sources and documentation
  68. X    relating to it included in this distribution are Copyright (c) 1991, by
  69. X    Jon Spencer.
  70. X
  71. X    Permission is given to redistribute any part or all of this
  72. X    distribution, either modified or unmodified, PROVIDED THAT:
  73. X    - the distribution is on a not-for-profit basis,
  74. X    - this copyright notice is included in the distribution,
  75. X    - and if a modified version is distributed, clear indication
  76. X      that it is modified is included.
  77. X
  78. X    All other rights are reserved by the author, Jon Spencer.
  79. X
  80. X
  81. X(disclaimer borrowed, somewhat modified, from the DICE distribution)
  82. X
  83. X    PROGRAM DISCLAIMER: THE LIBRARY IS PROVIDED "AS IS" WITHOUT WARRANTY OF
  84. X    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
  85. X    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  86. X    PURPOSE.  THE ENTIRE RISK AS TO THE RESULTS AND PERFORMANCE OF ANY
  87. X    PROGRAM IS ASSUMED BY YOU.    Should the program prove defective, you
  88. X    assume the entire cost of all necessary servicing, repair, or
  89. X    correction.
  90. X
  91. END_OF_FILE
  92. if test 1083 -ne `wc -c <'COPYRIGHT.NOTICE'`; then
  93.     echo shar: \"'COPYRIGHT.NOTICE'\" unpacked with wrong size!
  94. fi
  95. # end of 'COPYRIGHT.NOTICE'
  96. fi
  97. if test -f 'OVERVIEW' -a "${1}" != "-c" ; then 
  98.   echo shar: Will not clobber existing file \"'OVERVIEW'\"
  99. else
  100. echo shar: Extracting \"'OVERVIEW'\" \(622 characters\)
  101. sed "s/^X//" >'OVERVIEW' <<'END_OF_FILE'
  102. X
  103. X'sregexp.library' is a run time library of routines for doing wildcard
  104. Xpattern matching and wildcard path matching.  It accepts a slight extension
  105. Xof the AmigaDOS wildcard syntax, including a not operator, and character
  106. Xsets. It has routines to test if a string matches a wildcard expression,
  107. Xand for scanning through all matches to a wildcarded AmigaDOS path.  There
  108. Xare two nifty features to the path matching routines: '.../' means
  109. Xrecursively scan all subdirectories, and may come anywhere in the path; and
  110. Xwildcards are allowed in the volume node part of the path! (DH?: would
  111. Xmatch all your hard drive partitions.)
  112. END_OF_FILE
  113. if test 622 -ne `wc -c <'OVERVIEW'`; then
  114.     echo shar: \"'OVERVIEW'\" unpacked with wrong size!
  115. fi
  116. # end of 'OVERVIEW'
  117. fi
  118. if test -f 'clibrary.asm' -a "${1}" != "-c" ; then 
  119.   echo shar: Will not clobber existing file \"'clibrary.asm'\"
  120. else
  121. echo shar: Extracting \"'clibrary.asm'\" \(11630 characters\)
  122. sed "s/^X//" >'clibrary.asm' <<'END_OF_FILE'
  123. X
  124. X;**************************************************************************
  125. X;*                                      *
  126. X;* sregexp.library -- pattern matching run time library.          *
  127. X;*                                      *
  128. X;*                                      *
  129. X;* Startup module: this is heavily copied from the sample.library      *
  130. X;* in the RKM includes and autodocs.                      *
  131. X;* This also relies on some features of dice (in particular, registered   *
  132. X;* args and features of the linker.)  Be carefull if you make it with      *
  133. X;* something else.                              *
  134. X;*                                      *
  135. X;* Created: April 20, 1991                          *
  136. X;*                                      *
  137. X;**************************************************************************
  138. X
  139. X        CODE        sregexp.start
  140. X
  141. X        INCLUDE     "sregexpbase.i"
  142. X        INCLUDE     "exec/initializers.i"
  143. X        INCLUDE     "libraries/dos.i"
  144. X        INCLUDE     "exec/resident.i"
  145. X        INCLUDE     "exec/lists.i"
  146. X        INCLUDE     "exec/alerts.i"
  147. X        INCLUDE     "sreg_version.i"
  148. X
  149. X;--------------------------------------------------------------------
  150. X; some generally usefull macros hiding _LVO's
  151. X;--------------------------------------------------------------------
  152. XCALLSYS     macro
  153. X        jsr        _LVO\1(a6)
  154. X        endm
  155. X
  156. XXLIB        macro
  157. X        xref        _LVO\1
  158. X        endm
  159. X
  160. X;--------------------------------------------------------------------
  161. X; Declare the library calls I use. The _LVO's are brought in
  162. X; from amiga.lib
  163. X;--------------------------------------------------------------------
  164. X        XLIB        OpenLibrary
  165. X        XLIB        CloseLibrary
  166. X        XLIB        Alert
  167. X        XLIB        FreeMem
  168. X        XLIB        Remove
  169. X
  170. X;------ defined in Amiga.lib ------
  171. X        xref        _AbsExecBase
  172. X
  173. X;------ defined in the c source, the id string of my library. ------
  174. X        xref        _idString
  175. X
  176. X
  177. X
  178. X
  179. X;--------------------------------------------------------------------
  180. X; Make some stuff visible for debuging.
  181. X;--------------------------------------------------------------------
  182. X        xdef        Init
  183. X        xdef        EndCode
  184. X        xdef        RomTag
  185. X        xdef        funcTable
  186. X        xdef        dataTable
  187. X        xdef        InitRoutine
  188. X
  189. X        xdef        Open
  190. X        xdef        Close
  191. X        xdef        Expunge
  192. X        xdef        Reserved
  193. X
  194. X;--------------------------------------------------------------------
  195. X; The links to the c code are in the file kludge.asm, because the
  196. X; assembler I use doesn't like to make symbols starting with a @.
  197. X; But thats what DICE starts it's regargs routines with, so...
  198. X; I make the links with das, which comes with dice.
  199. X;
  200. X; my library routines
  201. X;--------------------------------------------------------------------
  202. X        xref        parsesregexp
  203. X        xref        freesregexp
  204. X        xref        matchsregexp
  205. X        xref        matchnsregexp
  206. X        xref        iswild
  207. X        xref        anchorpath
  208. X        xref        nextfile
  209. X        xref        buildpath
  210. X        xref        freespathinfo
  211. X
  212. X
  213. X
  214. X
  215. X
  216. X************************************************************************
  217. X* Ok, so much for the preamble, we can actually start to generate      *
  218. X* some code now.  The very first thing we should do is return an       *
  219. X* error if someone tries to run us like a program, seeing as we        *
  220. X* will be a perfectly legal AmigaDos load module.               *
  221. X************************************************************************
  222. X
  223. XStart:
  224. X        moveq.l     #-1,d0
  225. X        rts
  226. X
  227. X
  228. X;--------------------------------------------------------------------
  229. X; Ok, here's what exec is going to look for to tell it that we are
  230. X; a library.
  231. X;--------------------------------------------------------------------
  232. XRomTag:
  233. X        dc.w        RTC_MATCHWORD    ; magic
  234. X        dc.l        RomTag        ; pointer back to magic
  235. X        dc.l        EndCode        ; keep looking from here
  236. X        dc.b        RTF_AUTOINIT    ; yes, autoinit me.
  237. X        dc.b        VERSION        ; version number
  238. X        dc.b        NT_LIBRARY        ; I'm a library
  239. X        dc.b        0            ; no priority (typical)
  240. X        dc.l        sregexpname     ; I have a name
  241. X        dc.l        _idString        ; let's see some ID
  242. X        dc.l        Init        ; start me up
  243. X
  244. X
  245. X;--------------------------------------------------------------------
  246. X; Ok, heres the table of 4 vectors exec is going to look for
  247. X; to autoinit me.
  248. X;
  249. X; We are word alligned here.
  250. X;--------------------------------------------------------------------
  251. XInit:
  252. X        dc.l        SregExpBase_SIZE    ; size of library structure
  253. X        dc.l        funcTable        ; table of all my routines.
  254. X        dc.l        dataTable        ; LibStructure init data
  255. X        dc.l        InitRoutine     ; Where to start me.
  256. X
  257. X
  258. X;--------------------------------------------------------------------
  259. X; This is the list of functions in my library.
  260. X;--------------------------------------------------------------------
  261. XfuncTable:
  262. X        dc.l        Open
  263. X        dc.l        Close
  264. X        dc.l        Expunge
  265. X        dc.l        Reserved
  266. X
  267. X; my own little gems.
  268. X        dc.l        parsesregexp
  269. X        dc.l        freesregexp
  270. X        dc.l        matchsregexp
  271. X        dc.l        matchnsregexp
  272. X        dc.l        iswild
  273. X        dc.l        anchorpath
  274. X        dc.l        nextfile
  275. X        dc.l        buildpath
  276. X        dc.l        freespathinfo
  277. X        dc.l        -1            ; end of the list.
  278. X
  279. X;--------------------------------------------------------------------
  280. X; heres the stuff to initialise my Library structure.
  281. X;--------------------------------------------------------------------
  282. XdataTable:
  283. X        INITBYTE    LN_TYPE,NT_LIBRARY
  284. X        INITLONG    LN_NAME,sregexpname
  285. X        INITBYTE    LIB_FLAGS,LIBF_SUMUSED|LIBF_CHANGED
  286. X        INITWORD    LIB_VERSION,VERSION
  287. X        INITWORD    LIB_REVISION,REVISION
  288. X        INITLONG    LIB_IDSTRING,_idString
  289. X        dc.l        0
  290. X
  291. X
  292. X
  293. X*******************************************************************
  294. X* Ok, so now were really ready to get cooking.              *
  295. X* This routine is called when the library is first linked into      *
  296. X* the exec LibList.  The Library structure has already been      *
  297. X* initialised as per the dataTable instructions.          *
  298. X*                                  *
  299. X* When called, d0 has our library base and the segment list is      *
  300. X* pointed to by a0; a6 is a pointer to SysBase.           *
  301. X*******************************************************************
  302. X
  303. XInitRoutine:
  304. X        move.l        a4,-(sp)                ; put the lib pointer
  305. X        move.l        d0,a4            ; in a convinient place
  306. X
  307. X        move.l        a6,sb_SysBase(a4)       ; save SysBase
  308. X        move.l        a0,sb_SegList(a4)       ; save our seglist
  309. X
  310. X        lea.l        dosname(pc),a1          ; try and open up
  311. X        moveq.l     #0,d0            ; dos.library
  312. X        CALLSYS     OpenLibrary
  313. X
  314. X        move.l        d0,sb_DOSBase(a4)       ;save dos
  315. X        bne.s        1$
  316. X
  317. X
  318. X        ALERT        AG_OpenLib|AO_DOSLib    ; couldn't get dos!!!
  319. X
  320. X;------- That's all there is to do. --------
  321. X1$
  322. X        move.l        a4,d0
  323. X        move.l        (sp)+,a4
  324. X        rts
  325. X
  326. X
  327. X
  328. X***********************************************************************
  329. X* So good so far.  Now come the 4 standard library routines that      *
  330. X* every good library must have.  Each of these (in fact all of the    *
  331. X* library calls) comes with the pointer to our library base in a6.    *
  332. X***********************************************************************
  333. X
  334. X;----------------------------------------------------------------------
  335. X; To open the library, all we have to do is up the count of current
  336. X; users and reset the delayed expunge flag. This returns the library
  337. X; pointer on d0 if we successfully opened (which is always the case).
  338. X;----------------------------------------------------------------------
  339. XOpen:
  340. X        addq.w        #1,LIB_OPENCNT(a6)
  341. X        bclr        #LIBB_DELEXP,LIB_FLAGS(a6)
  342. X        move.l        a6,d0
  343. X        rts
  344. X
  345. X
  346. X
  347. X
  348. X;----------------------------------------------------------------------
  349. X; When we close the library, we decrease the count of current
  350. X; users. If this has reached zeros, then we check the delayed
  351. X; expunge flag and clean up if it is set.
  352. X; If this routine returns 0 then that's that.  If the return value
  353. X; is non-zero, it should be the segment pointer passed to the
  354. X; initialization routine, so we can be unloaded.
  355. X;----------------------------------------------------------------------
  356. XClose:
  357. X        ;--- set up the return value, which will be altered ---
  358. X        ;--- if we decide to do a delayed expunge.        ---
  359. X        moveq.l     #0,d0
  360. X        subq.w        #1,LIB_OPENCNT(a6)
  361. X        bne.s        1$
  362. X        btst        #LIBB_DELEXP,LIB_FLAGS(a6)
  363. X        beq.s        1$
  364. X
  365. X; --- take a shortcut into the Expunge routine that doesn't ---
  366. X; --- redo the tests we just did.                ---
  367. X        bsr.s        ReallyExpunge
  368. X
  369. X1$
  370. X; --- at this point, d0 is zero if we didn't expunge, otherwise ---
  371. X; --- it the address of our segment list.            ---
  372. X        rts
  373. X
  374. X
  375. X
  376. X;----------------------------------------------------------------------
  377. X; Ok, so now we want to try to unload.    First check if there
  378. X; are still any current openers, if so, just set the delayed
  379. X; expunge flag, and we'll go away when everyone closes us.
  380. X; Otherwise, clean up my resources and return the seg list to
  381. X; be unloaded
  382. X;----------------------------------------------------------------------
  383. XExpunge:
  384. X        tst.w        LIB_OPENCNT(a6)
  385. X        beq.s        ReallyExpunge
  386. X
  387. X        bset        #LIBB_DELEXP,LIB_FLAGS(a6)
  388. X        moveq.l     #0,d0            ;don't unload me please
  389. X        rts
  390. X
  391. XReallyExpunge:
  392. X        movem.l     d2/a5,-(sp)
  393. X        move.l        a6,a5
  394. X        move.l        sb_SysBase(a5),a6
  395. X
  396. X        move.l        sb_SegList(a5),d2       ;save seglist.
  397. X
  398. X        move.l        a5,a1            ;remove the library
  399. X        REMOVE                    ;from the system list
  400. X
  401. X        move.l        sb_DOSBase(a5),a1
  402. X        CALLSYS     CloseLibrary        ;close dos.
  403. X
  404. X        moveq.l     #0,d0
  405. X        move.l        a5,a1
  406. X        move.w        LIB_NEGSIZE(a5),d0
  407. X        sub.l        d0,a1
  408. X        add.w        LIB_POSSIZE(a5),d0
  409. X
  410. X        CALLSYS     FreeMem            ;free our library base.
  411. X
  412. X        move.l        d2,d0            ;unload us.
  413. X
  414. X        movem.l     (sp)+,d2/a5
  415. X        rts
  416. X
  417. X
  418. X;----------------------------------------------------------------------
  419. X; This is the reserved vector.    Just return 0.
  420. X;----------------------------------------------------------------------
  421. XReserved:
  422. X        moveq.l     #0,d0
  423. X        rts
  424. X
  425. X
  426. X
  427. X**********************************************************************
  428. X* That's all of the standard stuff.  As discussed above, the links   *
  429. X* to the c code are in the file kludge.asm                 *
  430. X**********************************************************************
  431. X
  432. X
  433. X
  434. X
  435. X
  436. X
  437. X
  438. X;----------------------------------------------------------------------
  439. X; Here are some stings used in the above.  I put them at the end so
  440. X; so I don't have to worry about alignment.
  441. X;----------------------------------------------------------------------
  442. Xdosname     DOSNAME
  443. X
  444. Xsregexpname    SREGEXPNAME
  445. X
  446. X;----------------------------------------------------------------------
  447. X; The end of the code, where exec can start looking for more RomTag
  448. X; structures if it wants to.
  449. X;----------------------------------------------------------------------
  450. X        EVEN
  451. XEndCode:
  452. X
  453. X
  454. X
  455. X
  456. X
  457. X**********************************************************************
  458. X*                                     *
  459. X* Now comes the clever part.  Dice (and the others, I think)         *
  460. X* references there global data from register a4.  What I do         *
  461. X* to have easy access to the Library structure data from the         *
  462. X* c code, is transfer a6 to a4 on each library call and then         *
  463. X* define the various things I want to access as offsets to         *
  464. X* this, in effect, tricking dice into thinking they're global        *
  465. X* variables.  The real benifit of this is I don't need my own        *
  466. X* custom links to the Exec and DOS library routines, because         *
  467. X* there exists perfectly valid global variables SysBase and         *
  468. X* DosBase.                                 *
  469. X*                                     *
  470. X**********************************************************************
  471. X
  472. X        DATA        data
  473. X
  474. X;---------------------------------------------------------------------
  475. X; This one is a little funny, it is the actual instance of the
  476. X; structure, and not a pointer to it.  It should be declared in
  477. X; the c code as 'extern struct SregExpBase SregExpBase;' and then
  478. X; referenced with the '.' and not the '->'.  This may not work
  479. X; I haven't tried it yet.
  480. X;----------------------------------------------------------------------
  481. X_SregExpBase    equ        0
  482. X        xdef        _SregExpBase
  483. X
  484. X;--- These are perfectly ordinary pointers ---
  485. X_SysBase    equ        sb_SysBase
  486. X        xdef        _SysBase
  487. X
  488. X_DOSBase    equ        sb_DOSBase
  489. X        xdef        _DOSBase
  490. X
  491. X        end
  492. X
  493. END_OF_FILE
  494. if test 11630 -ne `wc -c <'clibrary.asm'`; then
  495.     echo shar: \"'clibrary.asm'\" unpacked with wrong size!
  496. fi
  497. # end of 'clibrary.asm'
  498. fi
  499. if test -f 'compilation.notes' -a "${1}" != "-c" ; then 
  500.   echo shar: Will not clobber existing file \"'compilation.notes'\"
  501. else
  502. echo shar: Extracting \"'compilation.notes'\" \(1301 characters\)
  503. sed "s/^X//" >'compilation.notes' <<'END_OF_FILE'
  504. X
  505. X
  506. X    As it says in various places in the source, this whole thing is kind
  507. X    of DICE dependent.    If you know what you are doing you should be
  508. X    able to get it to compile under anything.
  509. X
  510. X    The c source was not written with an eye to portability, but I don't
  511. X    think it is too bad.
  512. X
  513. X    To make under another compiler you will almost definitely have to change
  514. X    the file kludge.asm, were the jump vectors into the code are.  Most
  515. X    likely you'll have to take the register parameters and stuff
  516. X    them onto the stack.
  517. X
  518. X    The easiest thing to do is just type 'dmake install' and trust
  519. X    my compilations.
  520. X
  521. X    PLEASE do not distribute modified versions, and if you do make sure
  522. X    the copyright notice is left intact AND you state clearly it is
  523. X    a modified version.
  524. X
  525. X
  526. X    Note that I made everything under 1.3 (I don't have 2.0).  There
  527. X    are a few things to consider, however.  I have made my own 1.3 version
  528. X    of the 'clib' directory, which is new to 2.0.  This also allowed
  529. X    me to make my own 1.3 registered args amigasr13.lib linker
  530. X    library.  If you want to remake this under 1.3 with dice, you will
  531. X    have to either come up with these yourself, or modify kludge.asm
  532. X    to stuff the parameters on to the stack. Under 2.0 everything should
  533. X    go, but no guarantees.
  534. X
  535. END_OF_FILE
  536. if test 1301 -ne `wc -c <'compilation.notes'`; then
  537.     echo shar: \"'compilation.notes'\" unpacked with wrong size!
  538. fi
  539. # end of 'compilation.notes'
  540. fi
  541. if test -f 'dmakefile' -a "${1}" != "-c" ; then 
  542.   echo shar: Will not clobber existing file \"'dmakefile'\"
  543. else
  544. echo shar: Extracting \"'dmakefile'\" \(1467 characters\)
  545. sed "s/^X//" >'dmakefile' <<'END_OF_FILE'
  546. X
  547. XOD = OBJS:sreg/
  548. X
  549. XCSRC = sregexp.c sreg_version.c spath.c
  550. XCOBJ = $(CSRC:"*.c":"$(OD)*.o")
  551. XOBJ = $(OD)clibrary.o $(OD)kludge.o $(COBJ)
  552. XJUNK = utils/try utils/remlib utils/bumprev
  553. XJUNKSRC = $(JUNK:"*":"*.c")
  554. X
  555. XLINKLIBS = amigasr13.lib cr.lib
  556. X
  557. XLIBRARY = sregexp.library
  558. X
  559. XCOPTS = -c -mRR -mS -proto
  560. X#COPTS = -c -mRR -mS -proto -D __DEBUG__
  561. X
  562. Xall : sregexpsr.lib sregexps.lib $(JUNK) $(LIBRARY)
  563. X
  564. X$(JUNK) : $(JUNKSRC)
  565. X    dcc -mRR -r -lsregexpsr -o %(left) %(right)
  566. X
  567. X$(LIBRARY) : $(OBJ)
  568. X    -Delete >NIL: %(left)
  569. X    dlink -o %(left) $(OBJ) $(LINKLIBS)
  570. X    utils/remlib $(LIBRARY)
  571. X    Protect %(left) -E
  572. X
  573. X$(OD)clibrary.o : clibrary.asm sreg_version.i
  574. X    -Delete >NIL: %(left)
  575. X    a68k -q -iAINC: -o%(left) clibrary.asm
  576. X
  577. X$(OD)kludge.o : kludge.asm
  578. X    -Delete >NIL: %(left)
  579. X    das -o%(left) %(right)
  580. X
  581. X$(COBJ) : $(CSRC)
  582. X    -Delete >NIL: %(left)
  583. X    dcc $(COPTS) -o %(left) %(right)
  584. X
  585. Xsregexpsr.lib : sregexp.fd sregexp_protos.h
  586. X    -Delete >NIL: %(left)
  587. X    fdtolib -mr sregexp.fd -o %(left) -h sregexp_protos.h
  588. X
  589. Xsregexps.lib : sregexp.fd
  590. X    -Delete >NIL: %(left)
  591. X    fdtolib sregexp.fd -o %(left)
  592. X
  593. Xsreg_version.i : $(CSRC) clibrary.asm kludge.asm utils/bumprev
  594. X    utils/bumprev
  595. X    touch sreg_version.i
  596. X
  597. Xclean :
  598. X    -Delete $(JUNK)
  599. X    -Delete $(OBJ)
  600. X    -Delete sregexpsr.lib sregexps.lib
  601. X
  602. Xinstall :
  603. X    Copy $(LIBRARY) Libs:
  604. X    Copy sregexpbase.h dinclude:pd/libraries
  605. X    Copy sregexp_protos.h dinclude:pd/clib
  606. X    Copy sregexps.lib dlib:
  607. X    Copy sregexpsr.lib dlib:
  608. END_OF_FILE
  609. if test 1467 -ne `wc -c <'dmakefile'`; then
  610.     echo shar: \"'dmakefile'\" unpacked with wrong size!
  611. fi
  612. # end of 'dmakefile'
  613. fi
  614. if test -f 'instillation.notes' -a "${1}" != "-c" ; then 
  615.   echo shar: Will not clobber existing file \"'instillation.notes'\"
  616. else
  617. echo shar: Extracting \"'instillation.notes'\" \(757 characters\)
  618. sed "s/^X//" >'instillation.notes' <<'END_OF_FILE'
  619. X
  620. X
  621. X    If you have dmake, then just change to this directory and
  622. X    type 'dmake install' and all of the files will be copied to
  623. X    the appropriate place (if not you can edit the dmake file)
  624. X
  625. X    If not, heres where they should go:
  626. X
  627. X    sregexp.library     should be copied to LIBS:
  628. X
  629. X    sregexps.lib        should go to DLIB:  If you use a different
  630. X    sregexpsr.lib        compiler, you will have to use whatever
  631. X                utility exists to turn the fd file into
  632. X                your kind of library.
  633. X
  634. X    sregexpbase.h        should go in the 'libraries' directory,
  635. X                where ever you keep your Amiga include
  636. X                files.
  637. X
  638. X    sregexp_protos.h    Under 2.0 this goes in 'clib'  I compiled
  639. X                everything under 1.3, but I have a fake
  640. X                1.3 clib directory of my own making.
  641. X                Basically put it where you want.
  642. X
  643. END_OF_FILE
  644. if test 757 -ne `wc -c <'instillation.notes'`; then
  645.     echo shar: \"'instillation.notes'\" unpacked with wrong size!
  646. fi
  647. # end of 'instillation.notes'
  648. fi
  649. if test -f 'kludge.asm' -a "${1}" != "-c" ; then 
  650.   echo shar: Will not clobber existing file \"'kludge.asm'\"
  651. else
  652. echo shar: Extracting \"'kludge.asm'\" \(1876 characters\)
  653. sed "s/^X//" >'kludge.asm' <<'END_OF_FILE'
  654. X
  655. X;-------------------------------------------------------------------
  656. X; Here are the links to the c code.  Anything that dice can't make
  657. X; registered arguement versions of would have to stick the stuff onto the
  658. X; stack.  Note that the fd file and dice must both have the same
  659. X; idea of what gets passed in what.  I will perhaps automate that
  660. X; one day.  For now just be carefull.
  661. X;-------------------------------------------------------------------
  662. X
  663. X        section     kludge,code
  664. X
  665. X        xdef        parsesregexp
  666. X        xref        @parsesregexp
  667. Xparsesregexp:
  668. X        move.l        a4,-(sp)
  669. X        move.l        a6,a4
  670. X        jsr        @parsesregexp(pc)
  671. X        move.l        (sp)+,a4
  672. X        rts
  673. X
  674. X        xdef        freesregexp
  675. X        xref        @freesregexp
  676. Xfreesregexp:
  677. X        move.l        a4,-(sp)
  678. X        move.l        a6,a4
  679. X        jsr        @freesregexp(pc)
  680. X        move.l        (sp)+,a4
  681. X        rts
  682. X
  683. X        xdef        matchsregexp
  684. X        xref        @matchsregexp
  685. Xmatchsregexp:
  686. X        move.l        a4,-(sp)
  687. X        move.l        a6,a4
  688. X        jsr        @matchsregexp(pc)
  689. X        move.l        (sp)+,a4
  690. X        rts
  691. X
  692. X        xdef        matchnsregexp
  693. X        xref        @matchnsregexp
  694. Xmatchnsregexp:
  695. X        move.l        a4,-(sp)
  696. X        move.l        a6,a4
  697. X        jsr        @matchnsregexp(pc)
  698. X        move.l        (sp)+,a4
  699. X        rts
  700. X
  701. X        xdef        iswild
  702. X        xref        @iswild
  703. Xiswild:
  704. X        move.l        a4,-(sp)
  705. X        move.l        a6,a4
  706. X        jsr        @iswild(pc)
  707. X        move.l        (sp)+,a4
  708. X        rts
  709. X
  710. X        xdef        anchorpath
  711. X        xref        @anchorpath
  712. Xanchorpath:
  713. X        move.l        a4,-(sp)
  714. X        move.l        a6,a4
  715. X        jsr        @anchorpath(pc)
  716. X        move.l        (sp)+,a4
  717. X        rts
  718. X
  719. X        xdef        nextfile
  720. X        xref        @nextfile
  721. Xnextfile:
  722. X        move.l        a4,-(sp)
  723. X        move.l        a6,a4
  724. X        jsr        @nextfile(pc)
  725. X        move.l        (sp)+,a4
  726. X        rts
  727. X
  728. X        xdef        buildpath
  729. X        xref        @buildpath
  730. Xbuildpath:
  731. X        move.l        a4,-(sp)
  732. X        move.l        a6,a4
  733. X        jsr        @buildpath(pc)
  734. X        move.l        (sp)+,a4
  735. X        rts
  736. X
  737. X        xdef        freespathinfo
  738. X        xref        @freespathinfo
  739. Xfreespathinfo:
  740. X        move.l        a4,-(sp)
  741. X        move.l        a6,a4
  742. X        jsr        @freespathinfo(pc)
  743. X        move.l        (sp)+,a4
  744. X        rts
  745. X
  746. X        end
  747. END_OF_FILE
  748. if test 1876 -ne `wc -c <'kludge.asm'`; then
  749.     echo shar: \"'kludge.asm'\" unpacked with wrong size!
  750. fi
  751. # end of 'kludge.asm'
  752. fi
  753. if test -f 'revision.history' -a "${1}" != "-c" ; then 
  754.   echo shar: Will not clobber existing file \"'revision.history'\"
  755. else
  756. echo shar: Extracting \"'revision.history'\" \(468 characters\)
  757. sed "s/^X//" >'revision.history' <<'END_OF_FILE'
  758. X
  759. X    version 9.x
  760. X    First version ready for general release, everything seems
  761. X    to work ok.
  762. X
  763. X    versions 4.0 - 8.xx
  764. X    Various steps on the long road to getting the path matching
  765. X    routines to actually work.
  766. X
  767. X    version 2.0 - 3.xx
  768. X    Porting of the pattern matching routines from a link time
  769. X    library to a run time library.
  770. X
  771. X    version 1.xx
  772. X    Figuring out how to make a @&*! Amiga run time library
  773. X    go.  WHY DOES IT GURU WHEN I EXPUNGE, AHHHHH!  Well
  774. X    it worked in the end.
  775. END_OF_FILE
  776. if test 468 -ne `wc -c <'revision.history'`; then
  777.     echo shar: \"'revision.history'\" unpacked with wrong size!
  778. fi
  779. # end of 'revision.history'
  780. fi
  781. if test -f 'spath.c' -a "${1}" != "-c" ; then 
  782.   echo shar: Will not clobber existing file \"'spath.c'\"
  783. else
  784. echo shar: Extracting \"'spath.c'\" \(12546 characters\)
  785. sed "s/^X//" >'spath.c' <<'END_OF_FILE'
  786. X
  787. X/**********************************************************************
  788. X * This is the stuff for matching to a wildcarded path. see the docs  *
  789. X *                                      *
  790. X *                                      *
  791. X *  Copyright (c) 1991 by Jon Spencer.                                *
  792. X *                                      *
  793. X *  Revision history:                              *
  794. X *    May 10, 1991        First version basically completed          *
  795. X *                                      *
  796. X **********************************************************************/
  797. X
  798. X#include "sregexp.h"
  799. X
  800. Xextern struct DosLibrary *DOSBase;
  801. X
  802. X#ifdef __DEBUG__
  803. Xvoid puts(char *);
  804. Xvoid printf(char *, ...);
  805. X#endif
  806. X
  807. X#define ROOT    ((struct RootNode *)DOSBase->dl_Root)
  808. X#define INFO    ((struct DosInfo *)ROOT->rn_Info<<2)
  809. X#define DEVC(a) ((struct DeviceList *)a<<2)
  810. X
  811. Xstruct SpathInfo *
  812. Xanchorpath(anc,wld)
  813. Xchar *anc,*wld;
  814. X/* This is routine sets everything up for matching wildcard paths.
  815. X   It does the expansion of any wildcards in the volume node part
  816. X   of the path, if any where specified, and gets ready to roll. */
  817. X{
  818. X    struct SpathInfo *spi;
  819. X    struct SpathNode *spn;
  820. X    BPTR lock;
  821. X    register char *q;
  822. X    char *node,*p,c;
  823. X    struct DeviceList *dvc;
  824. X    struct SregExp *pat;
  825. X
  826. X
  827. X    if (!(spi = getmem(sizeof(struct SpathInfo)))) {
  828. X    report(MEM_ERROR);
  829. X    return NULL;
  830. X    }
  831. X    NewList((struct List *)spi);
  832. X
  833. X    for (q = wld; *q != ':' && *q != '/' && *q; q++) ;
  834. X
  835. X    if (*q == ':') {
  836. X    if (!(node = getmem(q - wld + 1))) {
  837. X        report(MEM_ERROR);
  838. X        FreeMem(spi,sizeof(struct SpathInfo));
  839. X        FreeMem(spi,sizeof(struct SpathInfo));
  840. X        return NULL;
  841. X    }
  842. X    for (q = wld, p = node; *q != ':'; )
  843. X        *p++ = *q++;
  844. X    *p = 0;
  845. X
  846. X    pat = parsesregexp(node);
  847. X    FreeMem(node,strlen(node)+1);
  848. X    if (!pat) {
  849. X        FreeMem(spi,sizeof(struct SpathInfo));
  850. X        return NULL;
  851. X    }
  852. X
  853. X    /* Check if there is no path to parse */
  854. X    if (*(q+1)) {
  855. X        if (!(spi->spi_SregList = parsepath(q+1))) {
  856. X        freesregexp(pat);
  857. X        FreeMem(spi,sizeof(struct SpathInfo));
  858. X        return NULL;
  859. X        }
  860. X    } else
  861. X        spi->spi_SregList = NULL;
  862. X
  863. X
  864. X    if (pat->sre_Type == SRP_NULL) {  /* check for paths matching ":..." */
  865. X
  866. X        if (!(lock = Lock(anc,SHARED_LOCK))) {
  867. X        freesregexp(pat);
  868. X        freespathinfo(spi);
  869. X        return NULL;
  870. X        }
  871. X        if (!(node = getmem(2))) {
  872. X        report(MEM_ERROR);
  873. X        UnLock(lock);
  874. X        freesregexp(pat);
  875. X        freespathinfo(spi);
  876. X        return NULL;
  877. X        }
  878. X        node[0] = ':';
  879. X        node[1] = 0;
  880. X        if (!(spn = makespathnode(lock,node,spi->spi_SregList))) {
  881. X        UnLock(lock);
  882. X        FreeMem(node,2);
  883. X        freesregexp(pat);
  884. X        freespathinfo(spi);
  885. X        return NULL;
  886. X        }
  887. X        spn->spn_NodeName = node;
  888. X        AddTail((struct List *)spi,(struct Node *)spn);
  889. X        UnLock(lock);
  890. X    } else {
  891. X        for (dvc = DEVC(INFO->di_DevInfo); dvc; dvc = DEVC(dvc->dl_Next)) {
  892. X        p = (char *)dvc->dl_Name<<2;
  893. X        if (matchnsregexp(p+1,pat,FALSE,*p)) {
  894. X            if (!(node = getmem(*p+2))) {
  895. X            report(MEM_ERROR);
  896. X            freesregexp(pat);
  897. X            freespathinfo(spi);
  898. X            return NULL;
  899. X            }
  900. X            for (c = *p++, q = node; c > 0; c--)
  901. X            *q++ = *p++;
  902. X            *q++ = ':';
  903. X            *q = 0;
  904. X            if (dvc->dl_Type == DLT_DEVICE) {
  905. X            lock = Lock(node,SHARED_LOCK);  /* ignore non-filesystem devices */
  906. X            if (!lock)
  907. X                continue;
  908. X            UnLock(lock);
  909. X            }
  910. X            if (!(spn = makespathnode(NULL,node,spi->spi_SregList))) {
  911. X            FreeMem(node,strlen(node)+1);
  912. X
  913. X            freespathinfo(spi);
  914. X            return NULL;
  915. X            }
  916. X            spn->spn_NodeName = node;
  917. X            AddTail((struct List *)spi,(struct Node *)spn);
  918. X        }
  919. X        }
  920. X    }
  921. X    freesregexp(pat);
  922. X    } else {
  923. X    /* check if there is any path to parse */
  924. X    if (*wld) {
  925. X        if (!(spi->spi_SregList = parsepath(wld))) {
  926. X        FreeMem(spi,sizeof(struct SpathInfo));
  927. X        return NULL;
  928. X        }
  929. X    } else
  930. X        spi->spi_SregList = NULL;
  931. X
  932. X    if (!(spn = makespathnode(NULL,anc,spi->spi_SregList)))
  933. X        freespathinfo(spi);
  934. X    AddTail((struct List *)spi,(struct Node *)spn);
  935. X    }
  936. X    return spi;
  937. X}
  938. X
  939. X#undef ROOT
  940. X#undef INFO
  941. X#undef DEVC
  942. X
  943. Xstruct SregList *
  944. Xparsepath(wld)
  945. Xchar *wld;
  946. X/* This routine takes a wildcarded path and turns it into a singly
  947. X   linked list of SregExp structures, one node for each path element. */
  948. X{
  949. X    char *q,*p,*cp,c = 1,recurse;
  950. X    struct SregExp *sre;
  951. X    struct SregList *srl,*srr = NULL;
  952. X
  953. X    if (!(cp = getmem(strlen(wld)+1))) {
  954. X    report(MEM_ERROR);
  955. X    return NULL;
  956. X    }
  957. X    strcpy(cp,wld);
  958. X
  959. X    q = cp;
  960. X    while (*q && c) {
  961. X    if (strncmp(q,".../",4) == 0) {
  962. X        recurse = SRF_RECURSE;
  963. X        q += 4;
  964. X    } else
  965. X        recurse = 0;
  966. X    p = q;
  967. X    while (*q && *q != '/') q++;
  968. X    c = *q;
  969. X    *q = 0;
  970. X    if (!(sre = parsesregexp(p)))
  971. X        goto bad;
  972. X    sre->sre_Flag |= recurse;
  973. X    *q++ = c;
  974. X    if (!srr) {
  975. X        if (!(srl = srr = getmem(sizeof(struct SregList)))) {
  976. X        report(MEM_ERROR);
  977. X        goto bad;
  978. X        }
  979. X    } else {
  980. X        if (!(srl = (srl->srl_next = getmem(sizeof(struct SregList))))) {
  981. X        report(MEM_ERROR);
  982. X        goto bad;
  983. X        }
  984. X    }
  985. X    srl->srl_next = NULL;
  986. X    srl->srl_sreg = sre;
  987. X    }
  988. X    if (c == '/')           /* If path ends in a / then just take dirs */
  989. X    srl->srl_sreg->sre_Flag |= SRF_JUSTDIRS;
  990. X
  991. X    FreeMem(cp,strlen(cp)+1);
  992. X    return srr;
  993. X
  994. Xbad:
  995. X    if (sre)
  996. X    freesregexp(sre);
  997. X    FreeMem(cp,strlen(cp)+1);
  998. X
  999. X    while (srl) {
  1000. X    if (srl->srl_sreg)
  1001. X        freesregexp(srl->srl_sreg);
  1002. X    FreeMem(srl,sizeof(struct SregList));
  1003. X    srl = srl->srl_next;
  1004. X    }
  1005. X    return NULL;
  1006. X}
  1007. X
  1008. Xstruct SpathNode *
  1009. Xmakespathnode(lock,file,sreg)
  1010. XBPTR lock;
  1011. Xchar *file;
  1012. Xstruct SregList *sreg;
  1013. X/* This routine makes a new node to be linked into the list of current
  1014. X   directory locks, basically */
  1015. X{
  1016. X    struct SpathNode *spn;
  1017. X    BPTR cdir;
  1018. X
  1019. X
  1020. X    if (!(spn = getmem(sizeof(struct SpathNode)))) {
  1021. X    report(MEM_ERROR);
  1022. X    return NULL;
  1023. X    }
  1024. X    if (lock)
  1025. X    cdir = CurrentDir(lock);
  1026. X    if (!(spn->spn_Lock = Lock(file,SHARED_LOCK))) {
  1027. X    FreeMem(spn,sizeof(struct SpathNode));
  1028. X    return NULL;
  1029. X    }
  1030. X    spn->spn_SregList = sreg;
  1031. X    if (!(Examine(spn->spn_Lock,&spn->spn_FIB))) {
  1032. X    UnLock(spn->spn_Lock);
  1033. X    FreeMem(spn,sizeof(struct SpathNode));
  1034. X    return NULL;
  1035. X    }
  1036. X    spn->spn_Flags = 0;
  1037. X    spn->spn_NodeName = NULL;
  1038. X    if (lock)
  1039. X    CurrentDir(cdir);
  1040. X
  1041. X    return spn;
  1042. X}
  1043. X
  1044. X
  1045. X
  1046. X#define FILENAME    (spn->spn_FIB.fib_FileName)
  1047. X#define NEXTPATH    (spn->spn_SregList->srl_next)
  1048. X#define THISPATH    (spn->spn_SregList)
  1049. X#define LOCK        (spn->spn_Lock)
  1050. X#define FIB        (spn->spn_FIB)
  1051. X#define SREG        (spn->spn_SregList->srl_sreg)
  1052. X#define ISDIR        (FIB.fib_DirEntryType > 0)
  1053. X#define ISRECURSE    (SREG->sre_Flag & SRF_RECURSE)
  1054. X#define ISDONEONCE    (spn->spn_Flags & SPF_DONEONCE)
  1055. X#define ISJUSTDIRS    (SREG->sre_Flag & SRF_JUSTDIRS)
  1056. X#define WANTIT        (ISDIR ? dirs >= 0 : !ISJUSTDIRS && dirs <= 0)
  1057. X#define SIGBREAKF_ANY    (SIGBREAKF_CTRL_C | SIGBREAKF_CTRL_D | SIGBREAKF_CTRL_E | SIGBREAKF_CTRL_F)
  1058. X
  1059. Xint
  1060. Xnextfile(spi,buf,len,dirs)
  1061. Xstruct SpathInfo *spi;
  1062. Xchar *buf;
  1063. Xint len,dirs;
  1064. X/* This routine is a mess.  It jumps all over the place and is generally
  1065. X   hard to follow.  The basic idea behind it is to implement recursion,
  1066. X   but without using the stack.  Basically the linked list of SpathNode
  1067. X   structures, anchored in the SpathInfo structure works as our stack
  1068. X   for us.  "Why not just use the stack?" you ask.  Well, unfortunately,
  1069. X   we have to return in the middle of the scan, each time a new match
  1070. X   is found.  This would mean unrolling all of the stack that defines
  1071. X   how far through the search we are to get back to the return address.
  1072. X   By using the linked list of SpathInfo structures, we can preserve
  1073. X   the state of the 'stack' betweem calls. */
  1074. X{
  1075. X    struct SpathNode *spn;
  1076. X
  1077. X
  1078. Xtry_again:
  1079. X
  1080. X    if (SetSignal(0,0) & SIGBREAKF_ANY)
  1081. X    return SPE_SIGBREAK;
  1082. X
  1083. X    spn = spi->spi_TailPred;
  1084. X
  1085. X    /* check if we're done. */
  1086. X    if (!spn->spn_Pred) {
  1087. X    report(ERROR_NO_MORE_ENTRIES);
  1088. X    return SPE_ALL_DONE;
  1089. X    }
  1090. X
  1091. X    /* check if we're at the end of the path: used to match just nodes.*/
  1092. X    if (!THISPATH) {
  1093. X    if (ISDONEONCE)
  1094. X        goto pop;
  1095. X
  1096. X    spn->spn_Flags |= SPF_DONEONCE;
  1097. X
  1098. X    if (dirs >= 0) {
  1099. X        return buildpath(spi,buf,len);
  1100. X    } else
  1101. X        goto pop;
  1102. X    }
  1103. X
  1104. X    /* check if we set a delayed decend */
  1105. X    if (spn->spn_Flags & SPF_DECEND)
  1106. X    goto decend;
  1107. X
  1108. X    /* check if it matches the null string, ie parent dir */
  1109. X    if (SREG->sre_Type == SRP_NULL) {
  1110. X
  1111. X    /* Check if its done or there is no parent. */
  1112. X    if (ISDONEONCE || !ParentDir(LOCK))
  1113. X        goto pop;
  1114. X
  1115. X    spn->spn_Flags |= SPF_DONEONCE;       /* Mark it as done. */
  1116. X
  1117. X    /* mark it as parent match for buildpath */
  1118. X    spn->spn_Flags |= SPF_NEXTPARENT;
  1119. X
  1120. X    if (!(spn = makespathnode(LOCK,"/",NEXTPATH)))
  1121. X        return SPE_ERROR;
  1122. X    AddTail((struct List *)spi,(struct Node *)spn);
  1123. X    goto try_again;
  1124. X    }
  1125. X
  1126. X    /* Check if we can do it quickly */
  1127. X    if ((SREG->sre_Type == SRP_STRING ||
  1128. X                  SREG->sre_Type == SRP_ONECHAR) && !ISRECURSE) {
  1129. X    BPTR cdir,lock;
  1130. X
  1131. X    /* Have we already done it? */
  1132. X    if (ISDONEONCE)
  1133. X       goto pop;
  1134. X
  1135. X    /* Mark it as done. */
  1136. X    spn->spn_Flags |= SPF_DONEONCE;
  1137. X
  1138. X    cdir = CurrentDir(LOCK);
  1139. X    if (SREG->sre_Type == SRP_STRING)
  1140. X        lock = Lock(SREG->sre_Data.string,SHARED_LOCK);
  1141. X    else {
  1142. X        char n[2];
  1143. X
  1144. X        n[0] = SREG->sre_Data.onechar;
  1145. X        n[1] = 0;
  1146. X        lock = Lock(n,SHARED_LOCK);
  1147. X    }
  1148. X    CurrentDir(cdir);
  1149. X    if (!lock)
  1150. X        goto pop;
  1151. X    if (!Examine(lock,&FIB)) {
  1152. X        UnLock(lock);
  1153. X        return SPE_ERROR;
  1154. X    }
  1155. X    UnLock(lock);
  1156. X
  1157. X    if (!NEXTPATH) {
  1158. X        if (WANTIT)
  1159. X        return buildpath(spi,buf,len);
  1160. X        else
  1161. X        goto pop;
  1162. X    }
  1163. X    if (ISDIR) {
  1164. X        if (!(spn = makespathnode(LOCK,FILENAME,NEXTPATH))) {
  1165. X        return SPE_ERROR;
  1166. X        }
  1167. X        AddTail((struct List *)spi,(struct Node *)spn);
  1168. X        goto try_again;
  1169. X    }
  1170. X    goto pop;
  1171. X    }
  1172. X
  1173. X    while (ExNext(LOCK,&FIB)) {
  1174. X    if (SetSignal(0,0) & SIGBREAKF_ANY)
  1175. X        return SPE_SIGBREAK;
  1176. X
  1177. X    if (matchsregexp(FILENAME,SREG,FALSE)) {
  1178. X        if (ISDIR && ISRECURSE)
  1179. X        spn->spn_Flags |= SPF_DECEND;
  1180. X        if (!NEXTPATH) {
  1181. X        if (WANTIT)
  1182. X            return buildpath(spi,buf,len);
  1183. X        } else if (ISDIR) {
  1184. X        if (!(spn = makespathnode(LOCK,FILENAME,NEXTPATH))) {
  1185. X            return SPE_ERROR;
  1186. X        }
  1187. X        AddTail((struct List *)spi,(struct Node *)spn);
  1188. X        goto try_again;
  1189. X        }
  1190. X    }
  1191. X    if (ISDIR && ISRECURSE) {
  1192. Xdecend:
  1193. X        spn->spn_Flags &= ~SPF_DECEND;
  1194. X        if (!(spn = makespathnode(LOCK,FILENAME,THISPATH))) {
  1195. X        return SPE_ERROR;
  1196. X        }
  1197. X        AddTail((struct List *)spi,(struct Node *)spn);
  1198. X        goto try_again;
  1199. X    }
  1200. X    }
  1201. X
  1202. X    if (IoErr() != ERROR_NO_MORE_ENTRIES)
  1203. X    return SPE_ERROR;
  1204. X
  1205. Xpop:
  1206. X    RemTail((struct List*)spi);
  1207. X    freespathnode(spn);
  1208. X    goto try_again;
  1209. X}
  1210. X
  1211. X#undef FILENAME
  1212. X#undef NEXTPATH
  1213. X#undef THISPATH
  1214. X#undef LOCK
  1215. X#undef FIB
  1216. X#undef SREG
  1217. X#undef ISDIR
  1218. X#undef ISRECURSE
  1219. X#undef ISDONEONCE
  1220. X#undef ISJUSTDIRS
  1221. X#undef WANTIT
  1222. X
  1223. X
  1224. Xint
  1225. Xbuildpath(spi,buf,len)
  1226. Xstruct SpathInfo *spi;
  1227. Xchar *buf;
  1228. Xint len;
  1229. X/* This routine turns the current 'stack' of SpathNode structures into
  1230. X   a file name the AmigaDOS will like. */
  1231. X{
  1232. X    struct SpathNode *spn = spi->spi_Head;
  1233. X    int i = 0;
  1234. X    char *q;
  1235. X
  1236. X    if (len < 1)
  1237. X    return SPE_BUFF_FULL;
  1238. X
  1239. X    if (spn->spn_Succ && spn->spn_NodeName) {
  1240. X    while (spn->spn_Succ->spn_Succ && spn->spn_Succ->spn_NodeName) {
  1241. X        spn = spn->spn_Succ;
  1242. X    }
  1243. X    }
  1244. X
  1245. X    if (q = spn->spn_NodeName) {
  1246. X    while (*q && i < len)
  1247. X        buf[i++] = *q++;
  1248. X    if (i >= len)
  1249. X        return SPE_BUFF_FULL;
  1250. X    }
  1251. X    while (spn->spn_Succ) {
  1252. X    if (spn->spn_Flags & SPF_NEXTPARENT) {
  1253. X        buf[i++] = '/';
  1254. X        if (i >= len)
  1255. X        return SPE_BUFF_FULL;
  1256. X    } else {
  1257. X        q = spn->spn_FIB.fib_FileName;
  1258. X        while (*q && i < len)
  1259. X        buf[i++] = *q++;
  1260. X        if (i >= len)
  1261. X        return SPE_BUFF_FULL;
  1262. X        if (spn->spn_Succ->spn_Succ ||
  1263. X              spn->spn_SregList->srl_sreg->sre_Flag & SRF_JUSTDIRS) {
  1264. X        buf[i++] = '/';
  1265. X        if (i >= len)
  1266. X            return SPE_BUFF_FULL;
  1267. X        }
  1268. X    }
  1269. X    spn = spn->spn_Succ;
  1270. X    }
  1271. X
  1272. X    buf[i] = 0;
  1273. X    return i;
  1274. X}
  1275. X
  1276. Xvoid
  1277. Xfreespathinfo(spi)
  1278. Xstruct SpathInfo *spi;
  1279. X/* This routine frees all of the resoureces tied up in a SpathInfo
  1280. X   structure */
  1281. X{
  1282. X    struct SpathNode *spn;
  1283. X    struct SregList *srl,*next;
  1284. X
  1285. X    while (spn = (struct SpathNode *)RemTail((struct List *)spi))
  1286. X    freespathnode(spn);
  1287. X
  1288. X    for (srl = spi->spi_SregList; srl; srl = next) {
  1289. X    freesregexp(srl->srl_sreg);
  1290. X    next = srl->srl_next;
  1291. X    FreeMem(srl,sizeof(struct SregList));
  1292. X    }
  1293. X
  1294. X    FreeMem(spi,sizeof(struct SpathInfo));
  1295. X}
  1296. X
  1297. Xvoid
  1298. Xfreespathnode(spn)
  1299. Xstruct SpathNode *spn;
  1300. X/* This routine frees the memory and lock in a SpathNode structure. */
  1301. X{
  1302. X    if (spn->spn_NodeName) {
  1303. X    FreeMem(spn->spn_NodeName,strlen(spn->spn_NodeName)+1);
  1304. X    }
  1305. X    UnLock(spn->spn_Lock);
  1306. X    FreeMem(spn,sizeof(struct SpathNode));
  1307. X}
  1308. X
  1309. X
  1310. X#ifdef __DEBUG__
  1311. X
  1312. X/* This is some debugging stuff, not compiled into the release version. */
  1313. X
  1314. Xvoid
  1315. Xputs(c)
  1316. Xchar *c;
  1317. X{
  1318. X    Write(Output(),c,strlen(c));
  1319. X    Write(Output(),"\n",1);
  1320. X}
  1321. X
  1322. X#include <stdarg.h>
  1323. X
  1324. Xextern void vsprintf(char *, char *, va_list);
  1325. X
  1326. Xvoid printf(f, ...)
  1327. Xchar *f;
  1328. X{
  1329. X    char buff[100];
  1330. X    va_list va;
  1331. X
  1332. X    va_start(va,f);
  1333. X    vsprintf(buff,f,va);
  1334. X    va_end(va);
  1335. X    Write(Output(),buff,strlen(buff));
  1336. X}
  1337. X
  1338. X#endif
  1339. END_OF_FILE
  1340. if test 12546 -ne `wc -c <'spath.c'`; then
  1341.     echo shar: \"'spath.c'\" unpacked with wrong size!
  1342. fi
  1343. # end of 'spath.c'
  1344. fi
  1345. if test -f 'sreg_version.c' -a "${1}" != "-c" ; then 
  1346.   echo shar: Will not clobber existing file \"'sreg_version.c'\"
  1347. else
  1348. echo shar: Extracting \"'sreg_version.c'\" \(68 characters\)
  1349. sed "s/^X//" >'sreg_version.c' <<'END_OF_FILE'
  1350. X
  1351. X
  1352. Xconst __far char idString[] = "sreglib 9.4 ("__DATE__")\x0d\x0a";
  1353. END_OF_FILE
  1354. if test 68 -ne `wc -c <'sreg_version.c'`; then
  1355.     echo shar: \"'sreg_version.c'\" unpacked with wrong size!
  1356. fi
  1357. # end of 'sreg_version.c'
  1358. fi
  1359. if test -f 'sreg_version.i' -a "${1}" != "-c" ; then 
  1360.   echo shar: Will not clobber existing file \"'sreg_version.i'\"
  1361. else
  1362. echo shar: Extracting \"'sreg_version.i'\" \(44 characters\)
  1363. sed "s/^X//" >'sreg_version.i' <<'END_OF_FILE'
  1364. X
  1365. XVERSION     equ        9
  1366. XREVISION    equ        4
  1367. X
  1368. X
  1369. X
  1370. X
  1371. X
  1372. END_OF_FILE
  1373. if test 44 -ne `wc -c <'sreg_version.i'`; then
  1374.     echo shar: \"'sreg_version.i'\" unpacked with wrong size!
  1375. fi
  1376. # end of 'sreg_version.i'
  1377. fi
  1378. if test -f 'sregexp.fd' -a "${1}" != "-c" ; then 
  1379.   echo shar: Will not clobber existing file \"'sregexp.fd'\"
  1380. else
  1381. echo shar: Extracting \"'sregexp.fd'\" \(279 characters\)
  1382. sed "s/^X//" >'sregexp.fd' <<'END_OF_FILE'
  1383. X##base _SregExpBase
  1384. X##bias 30
  1385. X##public
  1386. XParseSregExp(p)(a0)
  1387. XFreeSregExp(p)(a0)
  1388. XMatchSregExp(p,p1,n)(a0,a1,d0)
  1389. XMatchNSregExp(p,p1,n)(a0,a1,d0,d1)
  1390. XIsWild(p)(a0)
  1391. XAnchorPath(anchor,path)(a0,a1)
  1392. XNextFile(p1,p2,n,n1)(a0,a1,d0,d1)
  1393. XBuildPath(p1,p2,n)(a0,a1,d0)
  1394. XFreeSpathInfo(p)(a0)
  1395. X##end
  1396. END_OF_FILE
  1397. if test 279 -ne `wc -c <'sregexp.fd'`; then
  1398.     echo shar: \"'sregexp.fd'\" unpacked with wrong size!
  1399. fi
  1400. # end of 'sregexp.fd'
  1401. fi
  1402. if test -f 'sregexp.h' -a "${1}" != "-c" ; then 
  1403.   echo shar: Will not clobber existing file \"'sregexp.h'\"
  1404. else
  1405. echo shar: Extracting \"'sregexp.h'\" \(1868 characters\)
  1406. sed "s/^X//" >'sregexp.h' <<'END_OF_FILE'
  1407. X
  1408. X/* This is used for COMPILING sregexp.library, it should not be included
  1409. X  if you just USE the library.    See sregexpbase.h */
  1410. X
  1411. X#include <stddef.h>
  1412. X#include <stdlib.h>
  1413. X#include <string.h>
  1414. X#include <ctype.h>
  1415. X#include <clib/exec_protos.h>
  1416. X#include <clib/dos_protos.h>
  1417. X#include <libraries/dosextens.h>
  1418. X#include "sregexpbase.h"
  1419. X
  1420. X#define TRUE    1
  1421. X#define FALSE    0
  1422. X
  1423. X
  1424. X#define MEM_ERROR    ERROR_NO_FREE_STORE    /* report no mem */
  1425. X#define ILLEGAL_ERR    ERROR_INVALID_COMPONENT_NAME   /* bad sregexp */
  1426. X
  1427. X
  1428. X/* some handy fingersaving macros. */
  1429. X#define realen(a)       (((a)->sre_Flag&(SRF_REPEAT|SRF_NOT))?0:(a)->sre_MinLen)
  1430. X#define isfixed(s)      (((s)->sre_Flag&(SRF_REPEAT|SRF_NOT|SRF_FIXLEN))==SRF_FIXLEN)
  1431. X#define matchset(s,c)   ((s)->sre_Data.setchar[(c)/8] & 1 << (c)%8)
  1432. X#define getmem(a)       AllocMem(a,0)
  1433. X
  1434. Xstatic struct SregExp *     parsesub(char **, char);
  1435. Xstatic struct SregExp *     makesum(struct SregList *, int);
  1436. Xstatic struct SregExp *     makeor(struct SregList *,int);
  1437. Xstatic struct SregExp *     parseone(char **, char);
  1438. Xstatic char            onechar(char **, char);
  1439. Xstatic char *            makeset(char **);
  1440. Xstatic int            matchsum(struct SregExp *[], int, char *, int, int);
  1441. Xstatic void            report(int);
  1442. Xstatic struct SpathNode *   makespathnode(BPTR, char *, struct SregList *);
  1443. Xstatic void            freespathnode(struct SpathNode *);
  1444. Xstatic struct SregList *    parsepath(char *);
  1445. X
  1446. Xextern struct SregExp *     parsesregexp(char *);
  1447. Xextern void            freesregexp(struct SregExp *);
  1448. Xextern int            matchsregexp(char *, struct SregExp *, int);
  1449. Xextern int            matchnsregexp(char *, struct SregExp *, int, int);
  1450. Xextern int            iswild(char *);
  1451. Xextern struct SpathInfo *   anchorpath(char *, char *);
  1452. Xextern int            nextfile(struct SpathInfo *, char *, int, int);
  1453. Xextern int            buildpath(struct SpathInfo *, char *, int);
  1454. Xextern void            freespathinfo(struct SpathInfo *);
  1455. X
  1456. END_OF_FILE
  1457. if test 1868 -ne `wc -c <'sregexp.h'`; then
  1458.     echo shar: \"'sregexp.h'\" unpacked with wrong size!
  1459. fi
  1460. # end of 'sregexp.h'
  1461. fi
  1462. if test -f 'sregexp.uu' -a "${1}" != "-c" ; then 
  1463.   echo shar: Will not clobber existing file \"'sregexp.uu'\"
  1464. else
  1465. echo shar: Extracting \"'sregexp.uu'\" \(12272 characters\)
  1466. sed "s/^X//" >'sregexp.uu' <<'END_OF_FILE'
  1467. Xbegin 600 sregexp.library
  1468. XM```#\P`````````!``````````````AC```#Z0``"&-P_TYU2OP````$```!V
  1469. XM6H`)"0````%*```0P````!X````N````+@```&8```"2````R@```-@```#L'
  1470. XM```!.@```5P```%H```!=````8````&,```!F````:0```&P```!O/_____@,
  1471. XM```("0#````*```!2N````X&`-```!0`"=```!8`!,```!@``!#``````"\,4
  1472. XM*$`I3@`B*4@`*D/Z`)YP`$ZN_=@I0``F9A9(YP$&+CP``X`'+'@`!$ZN_Y1,P
  1473. XMWV"`(`PH7TYU4FX`(`BN``,`#B`.3G5P`%-N`"!F"@@N``,`#F<"81).=4INL
  1474. XM`"!G"@CN``,`#G``3G5(YR`$*DXL;0`B)"T`*B)-(%$B:0`$(H@A20`$(FT`B
  1475. XM)DZN_F)P`")-,"T`$)/`T&T`$DZN_RX@`DS?(`1.=7``3G5D;W,N;&EB<F%RP
  1476. XM>0!S<F5G97AP+FQI8G)A<GD`3G$O#"A.3KH`<BA?3G4O#"A.3KH(MBA?3G4O^
  1477. XM#"A.3KH)'BA?3G4O#"A.3KH)."A?3G4O#"A.3KH.Y"A?3G4O#"A.3KH//BA?!
  1478. XM3G4O#"A.3KH5*"A?3G4O#"A.3KH8CBA?3G4O#"A.3KH98"A?3G4C?B@I6UT_1
  1479. XM)7PG*@!.5?_\*TC__'``0>W__$ZZ``HB0"`)3EU.=4CG.#(D`$Y5_^PK2/_\;
  1480. XM<``K0/_TE<IV`'@`(&W__"!0M!!F``$F0?H.IBM(_^QP`4'M_^Q.N@/6(D`@>
  1481. XM"6```=Y@``$(<`$@;?_\3KH#P"9`(`MF!&```6)*K?_T9RH@;?_X+$AR`'`(0
  1482. XM3KH>U"U```0K;@`$__A*K?_X9BYP9TZZ#C)@``$T8")R`'`(3KH>L"M`__0K`
  1483. XM;?_T__A*K?_X9@IP9TZZ#@Y@``$0+&W_^"R++&W_^'``+4``!%*#+&W__"Q6$
  1484. XM#!8`?&8``((@`R!M__1.N@%2)D`@"V8$8```W"`*9RH@;?_P+$AR`'`(3KH>V
  1485. XM4"U```0K;@`$__!*K?_P9BIP9TZZ#:Y@``"P8!YR`'`(3KH>+"1`*TK_\$JMF
  1486. XM__!F"G!G3KH-CF```)`L;?_P+(LL;?_P<``M0``$4H0L;?_\4I9P`"M`__1V'
  1487. XM`"QM__PL5K069@#^\"`#(&W_]$ZZ`,8F0"`+9@)@4"`*9T@@;?_P+$AR`'`(!
  1488. XM3KH=QBU```0K;@`$__!*K?_P9@AP9TZZ#21@)BQM__`LBRQM__!P`"U```12,
  1489. XMA"`$($I.N@%.)D`@"V8"8`0@"V!D*VW_]/_X8"0@;?_X*V@`!/_T(FW_^"!1`
  1490. XM3KH&9'`((&W_^$ZZ'7(K;?_T__A*K?_X9M8K2O_X8"0@;?_X*V@`!/_T(FW_]
  1491. XM^"!13KH&-'`((&W_^$ZZ'4(K;?_T__A*K?_X9M9P`$Y=3-],'$YU2.<^,B1(V
  1492. XM)`!X`'H$2H)F$B`\````TDZZ#'9P`&```+!@%G`!L()F$"Q2<`@@2DZZ'/H@#
  1493. XM#F```)A"IR("Y8$@`5"`(A].NAS4+$`@#F8,<&=.N@P\<`!@``!V'+P`!QU\4
  1494. XM`````2U"``1V`&!4(%(2*``!2(%(P7P#PH9G!'``8`H@4C(H``)(P2`!V(`@9
  1495. XM4A(H``%(@4C!?`?"AGP$O(%F!'`$8`)P`,H`(`/E@"V2"`@F:@`$<`@@2DZZV
  1496. XM''`D2U*#M(-NJ#U$``*++@`!(`Y,WTQ\3G5(YSXR)$@D`'H$0J<B`N6!(`%0/
  1497. XM@"(?3KH<+BQ`(`YF#'!G3KH+EG``8```Y!R\``8=?`````$M0@`$=@!@``#`4
  1498. XM2H-F(B!2$"@``4B`2,!R`\"!9P9X`&```'(@4C`H``)(P"@`8&0@4A(H``%(R
  1499. XM@4C!?`/"AF<$<`!@"B!2,B@``DC!(`&PA&=">@`@4A(H``%(@4C!?`/"AF<$6
  1500. XM<`!@"B!2,B@``DC!(`&PA&P>(%(0*``!2(!(P'(#P(%G!'@`8`H@4C`H``)(B
  1501. XMP"@`(%(2*``!2(%(P7P'PH9\!+R!9@1P!&`"<`#*`"`#Y8`MD@@()FH`!'`(,
  1502. XM($I.NAM>)$M2@[2#;@#_/CU$``*++@`!(`Y,WTQ\3G5(YS`R)$@D`$Y5__P@1
  1503. XM4A`0D#P`*F<``3YJ))`\`-9G``&4D#P`(V<\50!G``%85P!G``"04P!G``%\F
  1504. XM8``!B)`\`!5G``#@D#P`'&<``(A5`&<``6*0/``?9P`!6E4`9T)@``%B4I)P)
  1505. XM`"!*3KK_E"9`(`MF!G``8``"$@@K`````6<6(#P```#23KH*'"!+3KH#FG``S
  1506. XM8``!]`CK``$``6```>A2DG``($I.NO]6)D`@"V8&<`!@``'4".L````!8``!E
  1507. XMR%*2<"D@2DZZ^RHF0%*28``!ME*2<@!P"$ZZ&E8F0"(+9@QP9TZZ";YP`&``^
  1508. XM`9P6O``!%WP`!``!-WP``0`"($I.N@'8)T``!$JK``1F#G`$($M.NAHL<`!@>
  1509. XM``%N4I)@``%F4I)R`'`(3KH:!B9`(@MF#'!G3KH);G``8``!3!:\``(7?``$S
  1510. XM``$W?``!``)@``$V4I)R`'`(3KH9UB9`(@MF#'!G3KH)/G``8``!'!:\``(76
  1511. XM?``&``$W?``!``)@``$&4I)R`'`(3KH9IB9`(@MF#'!G3KH)#G``8```[!:\^
  1512. XM``47?``$``$W?`````)@``#6(#P```#23KH(ZG``8```R'(`<`A.NAEH)D`B#
  1513. XM"V8,<&=.N@C0<`!@``"N%WP`!``!2@)F&G``($I.N@"D%T``!!:\``,W?``!`
  1514. XM``)@``"(*U+__'8`8`)2@W``0>W__$ZZ`'X2`$H!9NXW0P`"<@&R@V82<``@+
  1515. XM2DZZ`&870``$%KP``V!0%KP`!'(`<`'0@TZZ&.XG0``$*VL`!/_\2JW__&82<
  1516. XM<&=.N@A,<`0@2TZZ&.!P`&`B(&W__%*M__PL2'``($I.N@`:'(!*%F;H+&W_8
  1517. XM_!R\```@"TY=3-],#$YU2.<@("1()``@4@P0`"=F!%*28"8@4A`02(!(P$'Z5
  1518. XM^1Y.NA1F(D`@"68,2@)G#")2#!$`+68$<`!@"B!24I(0$$B`2,!,WP0$3G5(;
  1519. XMYS\P)$A.5?_\&WP``/__=``@4@P0`'YF"%*2&WP``?__<@!P($ZZ&"XF0"(+`
  1520. XM9@QP9TZZ!Y9P`&```0QV`&`,$`-(@!>\`````%(#MCP`(&WN8```DG0!(%(,"
  1521. XM$``M9EI2DG`!($I.NO].&`!*!&9$(#P```#23KH'4G`@($M.NA?F<`!@``#``
  1522. XM8"H0`TB`2,!R"$ZZ$IXJ`!(#2(%(P2`!<@A.NA).(@!\`>.F(@:#,U@`4@.X>
  1523. XM`VS28"P2`TB!2,$@`7((3KH2;"(`*@$<`TB&2,8@!G((3KH2&BP`?@'MIRP'C
  1524. XMC3-8`$AX``$@2B`?3KK^QA8`2@-F`/]>2@)G""!2#!``76<:2'@`TB`?3KH&Z
  1525. XMO$AX`"`@2R`?3KH73'``8"9*+?__9QYV`&`4'`-(AAH#2(4:,U``1@47A6``&
  1526. XM4@.V/``@;>8@"TY=3-\,_$YU2.<P("1(=``,$@`'9P8,$@`&9B(@*@`$Y8`DZ
  1527. XM`'8`8`X@`^6`('(("$ZZ_]92@[:J``1M[&`N#!(`!&88(&H`!$ZZ$E8F`%*#D
  1528. XM(`,@:@`$3KH6R&`0#!(``68*<"`@:@`$3KH6MG`(T((@2DZZ%JQ,WP0,3G5(,
  1529. XMYS`P)$@F220`($I.NA(6(@`@`B)+($I.N@`,)@`@`TS?#`Q.=4CG/C(D2"9)8
  1530. XM)``F`0@K``$``6<``.Y*@V<&#!,``F8&>`%@``+>,"L``DC`L(-N*A`K``%()
  1531. XM@$C`"````F<B2FL``F<6,"L``DC`(@/!04ZZ$+HB`"`!2H!G!G@`8``"I'P!B
  1532. XMS"L``0(K`/P``0@K``(``6<P+$I@(C(K``)(P2`"(DL@3DZZ_WHH`$J$9@1@-
  1533. XM``)R,BL``DC!W<$B#I**MH%NUF!2*@-@."(%(`(B2R!*3KK_3B@`2H1G)`CKA
  1534. XM``$``2(#DH4@`B)+($K1Q4ZZ_S(H`$J$9P)@'@BK``$``5.%2FL``F<*,"L`S
  1535. XM`DC`(@!@`G(!LH5OLG`"@`:!*P`!8``"`CPK``)(QKR#;A@<*P`!2(9(Q@@&0
  1536. XM``)G$#PK``)(QKR#9P9X`&```=H<$U,&9P``?E,&9P`!7%,&9S93!F<``5Y3!
  1537. XM!F<``8Q3!F<``9!3!F<$8``!KB\"+P,O"B\K``1(:P`(3KH!N$_O`!0H`&``N
  1538. XM`9)\`;R#9BI*@F<*'!*\*P`$9R1@'!P22(9!^A)3T,8<*P`$2(9#^A)'TL8<1
  1539. XM$+P19P9X`&```5QX`6```59\`;R#9C0<$DB&2,8@!G((3KH/BBP`(&L`!-'&B
  1540. XM'!!(ADC&$!)(@$C`<@A.N@\P<@'AH2`!P(9F``"F2H)G!&```)@0$DB`0?H0'
  1541. XMY=#`<``0$`@```=G0A`22(!!^A+9T,!P`!`0<@A.N@]@(&L`!-'`$!!(@$C`N
  1542. XM+``0$DB`0?H2M]#`<``0$'((3KH/"G(!X:$@`<"&9DA@0!`22(!!^A&3T,!P(
  1543. XM`!`0<@A.N@\>(&L`!-'`$!!(@$C`+``0$DB`0?H1<=#`<``0$'((3KH.R'(!=
  1544. XMX:$@`<"&9@9X`&```'AX`6```')X`'`!L(-7Q$0$8&1*@F<8(`,B:P`$($I.J
  1545. XMN@]B(@!X`$J!5\1$!&!((`,B:P`$($I.N@^R(@!X`$J!5\1$!&`P>`!*@U?$Z
  1546. XM1`1@)GH`8!PB`R`"+`7EAB)S:`@@2DZZ_1`H`$J$9P)@"%*%NJL`!&W>""L`P
  1547. XM```!9PQP`$J$5\!$`&`$8`(@!$S?3'Q.=4CG/S(D;P`H)F\`,"0O`#0F+P`XA
  1548. XM3E4``&`X(%(R*``"2,$@`R)2($M.NORX*@!*A68&<`!@``)<(E(R*0`"2,'74
  1549. XMP2)2,BD``DC!E(%8BE.M`#!*K0`P9P``>B)2$BD``4B!2,%P!\*`<`2P@6>L]
  1550. XM8&(@+0`P4X#E@")R"``R*0`"2,$@`RXM`#!3A^6'(G)X`"XM`#!3A^6'+')X@
  1551. XM`#XN``)(QT2'0?,H`-''3KK\-BH`2H5F!G``8``!VB(M`#!3@>6!(G(8`#(I&
  1552. XM``)(P92!4ZT`,$JM`#!G("(M`#!3@>6!(G(8`!(I``%(@4C!<`?"@'`$L(%GV
  1553. XM`/]Z2JT`,&8&<`%@``&0?`!X`6```10B!.6!(G(8`!(I``%(@4C!<`?"@'`$+
  1554. XML(%F``#*8```IB`$Y8`B<@@`,BD``DC!(`,N!.6'(G)X`"!+T<9.NON8*@!*0
  1555. XMA6<``'PO`R\&+PLO!"\*3KK^H$_O`!0J`$J%9@9P`&```2(O`R`"D(8B!.6![
  1556. XM(G(8`#(I``)(P42!TH`O`2($Y8$B<A@`,BD``D'S:`#0P4A0("T`,)"$4X`O&
  1557. XM`'`!T(3E@$AR"`!.NOY*3^\`%"H`2H5F!G``8```S'`!8```QE*&(`*0AB($<
  1558. XMY8$@<A@`,B@``DC!LH!O`/]&<`!@``"F8"PB!.6!('(8`!(H``%(@4C!?@/"C
  1559. XMAV<$<`!@$"($Y8$@<A@`,B@``DC!(`'<@%*$("T`,%.`L(1N`/[D<`&PK0`P2
  1560. XM9A(B`B`#(E(@2TZZ^J8N`"`'8$XL`F`\(@8@`R)2($M.NOJ0+@!*AV<H+P,@O
  1561. XM`I"&+P!(<V@`("T`,%.`+P!(:@`$3KK]C$_O`!1*@&<$<`%@$%.&(E(P*0`"`
  1562. XM2,"PAF^X<`!.74S?3/Q.=4Y5__PK2/_\<`!![?_\3KKX!A(`2@%F\"!M__QR.
  1563. XM`$H05L%$`2`!3EU.=4CG("`D`)'(3KH0PB1`(`IG!"5"`)1,WP0$3G4E`$YQ9
  1564. XM<W)E9VQI8B`Y+C0@*$UA>2`Q,"`Q.3DQ*0T*`$CG.#).5?_D*TC__"M)__ARQ
  1565. XM`'`03KH0.BM`__1*K?_T9@QP9TZZ_YYP`&```Z0@;?_T3KH*I"MM__C_[&`$3
  1566. XM4JW_["!M_^P,$``Z9Q(@;?_L#!``+V<((&W_[$H09N`@;?_L#!``.F8``OIR=
  1567. XM`"@M_^R8K?_X<`'0A$ZZ#]8K0/_H2JW_Z&8@<&=.NO\Z<!`@;?_T3KH/S'`0?
  1568. XM(&W_]$ZZ#\)P`&```RPK;?_X_^PK;?_H_^1@$B!M_^12K?_D(FW_[%*M_^P0L
  1569. XMD2!M_^P,$``Z9N0@;?_D$+P``"!M_^A.NO`:)D`@;?_H3KH*^%*`(&W_Z$ZZ=
  1570. XM#VX@"V80<!`@;?_T3KH/8'``8``"RB!M_^Q**``!9S0@;?_T+$AP`2!`T>W_Y
  1571. XM[$ZZ`K8M0``,2JX`#&8B($M.NO@6<!`@;?_T3KH/)'``8``"CF`*(&W_]'``G
  1572. XM(4``#`P3``5F``#*</X@;?_\3KH.:"0`2H)F%"!+3KKWW"!M__1.N@C2<`!@7
  1573. XM``)6<@!P`DZZ#LXK0/_H2JW_Z&8@<&=.NOXR(`).N@Y(($M.NO>J(&W_]$ZZ!
  1574. XM"*!P`&```B0@;?_H$+P`.B!M_^@1?`````$@;?_T(F@`#"!M_^@@`DZZ`X0K`
  1575. XM0/_P2JW_\&8D(`).N@X`<`(@;?_H3KH.=B!+3KKW6"!M__1.N@A.<`!@``'2,
  1576. XM(&W_\"%M_^@!%")M__`@;?_T3KH.7"`"3KH-QF```3PB;``F(FD`(B`I`!CEW
  1577. XM@")`("D`!.6`)$!@``$:("H`*.6`*T#_Y")M_^02$4B!2,%P`")+>`$@1-'MW
  1578. XM_^1.NO>$*`!*A&<``.AR`")M_^08$4B$2,1P`M"$3KH-UBM`_^A*K?_H9AIPA
  1579. XM9TZZ_3H@2TZZ]K@@;?_T3KH'KG``8``!,B!M_^12K?_D%A`K;?_H_^Q@%"!MJ
  1580. XM_^Q2K?_L(FW_Y%*M_^00D5,#2@-NZ"!M_^Q2K?_L$+P`.B!M_^P0O```2JH`C
  1581. XM!&88</X@;?_H3KH,W"0`2H)F`F!8(`).N@SF(&W_]")H``P@;?_H<`!.N@)(,
  1582. XM*T#_\$JM__!F("!M_^A.N@C"4H`@;?_H3KH-."!M__1.N@<6<`!@``":(&W_Z
  1583. XM\"%M_^@!%")M__`@;?_T3KH-)"`2Y8`D0"`*9@#^Y"!+3KKUZF!J(&W_^$H08
  1584. XM9R@@;?_T+$@@;?_X3KH`8BU```Q*K@`,9AIP$"!M__1.N@S6<`!@0&`*(&W_>
  1585. XM]'``(4``#"!M__0B:``,(&W__'``3KH!J"M`__!*K?_P9@@@;?_T3KH&B")MC
  1586. XM__`@;?_T3KH,IB`M__1.74S?3!Q.=4CG,#!.5?_L*TC__'0!E\M"IR!M__Q.+
  1587. XMN@?P4H`B'TZZ#%@K0/_P2JW_\&8,<&=.NON\<`!@``$^(FW__"!M__!.N@@&C
  1588. XM*VW_\/_X8```N'`$0_H&J"!M__A.N@>^(@!*@68(=H!8K?_X8`)V`"MM__C_Y
  1589. XM]&`$4JW_^")M__A*$6<*(FW_^`P1`"]FZB)M__@4$2)M__@2O```(&W_]$ZZ)
  1590. XM[((K0/_L2JW_[&8$8```BB!M_^R'*``!(&W_^%*M__@0@B(+9AIR`'`(3KH+8
  1591. XMKB9`)$LB"F8F<&=.NOL48%I@''(`<`A.N@N4)4``!"1J``0B"F8(<&=.NOKV4
  1592. XM8#QP`"5```0DK?_L(&W_^$H09P9*`F8`_SZT/``O9@@@4@CH``8``2!M__!.K
  1593. XMN@;B4H`@;?_P3KH+6"`+8#Y*K?_L9P@@;?_L3KKT+B!M__!.N@:^4H`@;?_PM
  1594. XM3KH+-&`62I)G!B!23KKT$'`(($I.N@L@)&H`!"`*9N9P`$Y=3-\,#$YU2.<PA
  1595. XM,B0`)$@F27(`(#P```$:3KH*Z"Q`(@YF#'!G3KKZ4'``8```=DJ"9P@@`DZZV
  1596. XM"IPF`'#^($I.N@HZ+4`!#$JN`0QF$"`\```!&B!.3KH*O'``8$8M2P$00>X`F
  1597. XM""`N`0Q.N@HX(@!*@688("X!#$ZZ"AH@/````1H@3DZZ"HYP`&`8/7P```$8>
  1598. XM<``M0`$42H)G!B`#3KH*-"`.3-],#$YU2.<\,B1()DDD`"8!3E7__'(`<`!.9
  1599. XMN@J4*`#(O```\`!G!G#\8``#1"QJ``A*K@`$9A`@/````.A.NOF4</]@``,J9
  1600. XM2JX!$&8P""X``0$99P1@``,(".X``0$92H-M``+\(`(B2R!*3KH#"B(`(`%@`
  1601. XM``+Z8`1@``+D""X```$99P1@``*&(FX!$")1#!$`!698,BX!&$C!"`$``68`O
  1602. XM`KX@+@$,3KH)IB(`2H%F!&```JP([@`!`1D([@`"`1D@;@$0(F@`!$'Z!!0@Z
  1603. XM+@$,3KK^D"Q`(`YF!G#^8``"D").($I.N@F88`#_*B)N`1`B40P1``1G#B)N]
  1604. XM`1`B40P1``-F``(T(FX!$")1$"D``4B`2,`(```'9@`"'@@N``$!&6<$8``"1
  1605. XM.`CN``$!&2`N`0Q.N@CZ*``B;@$0(E$,$0`$9A1P_B)N`1`B42!I``1.N@B$H
  1606. XM*@!@'B!N`1`@4!MH``3__AM\``#__W#^0>W__DZZ"&0J`"`$3KH(M$J%9@1@(
  1607. XM``'<0>X`""`%3KH(<B(`2H%F#"`%3KH(5G#^8``!T"`%3KH(2B!N`1!*J``$8
  1608. XM9D)*K@`,;PA*@VT``:1@'"!N`1`@4!`H``%(@$C`"```!F8``8Q*@VX``88@Y
  1609. XM`B)+($I.N@&4(@`@`6```81@!&```6Y*K@`,;P`!9B!N`1`B:``$0>X`$"`NE
  1610. XM`0Q.NOU6+$`@#F8&</Y@``%6(DX@2DZZ"%Y@`/WP8``!-F```0QR`'``3KH(>
  1611. XM>BH`RKP``/``9P9P_&```2IP`"!N`1`B4$'N`!!.NO%V*@!*A6<``)9*K@`,G
  1612. XM;QHB;@$0(E$:*0`!2(5(Q0@%``=G!@CN```!&2)N`1!*J0`$9CA*K@`,;P9*%
  1613. XM@VU@8!@B;@$0(E$:*0`!2(5(Q0@%``9F2DJ#;D8@`B)+($I.N@#"*@`@!6``P
  1614. XM`+)@,DJN``QO+"!N`1`B:``$0>X`$"`N`0Q.NOR*+$`@#F8&</Y@``"*(DX@F
  1615. XM2DZZ!Y)@`/TD2JX`#&]`(FX!$")1$"D``4B`2,`(```'9RP(K@```1DB;@$00
  1616. XM0>X`$"`N`0Q.NOQ"+$`@#F8$</Y@0B).($I.N@=,8`#\WD'N``@@+@$,3KH&#
  1617. XMU"(`2H%F`/[D3KH&\"(`LKP```#H9P1P_F`0($I.N@<L($Y.N@%"8`#\J$Y=5
  1618. XM3-],/$YU2.<@,B10<@!T`;2`;P9P_6```,9*DF<82JH!%&<28`(D4BQ22I9G(
  1619. XM""Q22JX!%&;P)FH!%"0+9P``E&`,)`%2@2Q+4HL3EB@`2A-G!+"!;NRP@6X`S
  1620. XM`'AP_6```'Y@``!N""H``@$99Q0D`5*!$[P`+R@`L(%N5'#]8%Y@3D?J`!!@E
  1621. XM#"0!4H$L2U*+$Y8H`$H39P2P@6[LL(%N!'#]8#HL4DJ69A0L:@$0+%84+@`!J
  1622. XM2()(P@@"``9G$B0!4H$3O``O*`"P@6X$</U@#B122I)FD!.\```8`"`!3-],`
  1623. XM!$YU2.<`,DY5__PK2/_\8`8@2DZZ`$0@;?_\3KH&("1`(`IF["!M__PF:``,(
  1624. XM8!0@4TZZ[M(L:P`$<`@@2TZZ!=XF3B`+9NAP$"!M__Q.N@7.3EU,WTP`3G4O\
  1625. XM"B1(2JH!%&<2(&H!%$ZZ`312@"!J`11.N@6J("H!#$ZZ!2(@/````1H@2DZZK
  1626. XM!98D7TYU+P`N+BXO``!#Z``$((EP`"%```0A2``(3G5.<4J!:PQ*@&L880``9
  1627. XM8B`!3G5$@4J`:Q9A``!41($@`4YU1(!A``!(1($@`4YU1(!A```\(`%.=4YQ.
  1628. XM80``,B`!3G5*@6L(2H!K$F```")$@4J`:Q)A```81(!.=42`80``#D2`3G5$(
  1629. XM@&````1.<4J!9QY(04I!9D(O`DA!)`"$P6D4(@)"04A!<``P`B0?3G4B`'#_X
  1630. XM3G4O`R0`0D)(0H3!-@)(0T)#-`"$P38"(`-"0DA"(@(F'R0?3G5(YS@`)`!"2
  1631. XM0DA"A,$V`G0`-`/&P4A!.`+(P4A#UH20@VL*(@`@`DS?`!Q.=5."T(%K^B(`O
  1632. XM(`),WP`<3G4B2&`"4HA*$&;Z(`B0B4YU2H!F&'``8"1@$DH!9P93@$J`9@1PM
  1633. XM`&`44HA2B1(0LA%GZ+(19`1P_V`"<`%.=4YQ+PHD2&`$4HE2B!"12A!F]B`*+
  1634. XM)%].=4YQ8`P2`+(09@0@"&`04HA*$&;P2H!F!"`(8`)P`$YU3G%(YR`P2H!FP
  1635. XM&'``8%!@$DH!9P93@$J`9@1P`&!`4HA2B1(0=``4`47Z`D74PG0`%!%'^@([,
  1636. XMUL(4$K039])T`!0!1_H"*];"=``4$47Z`B'4PA03M!)D!'#_8`)P`4S?#`1.^
  1637. XM=4YQ``0$!`0$!`0$!$1$1$1$!`0$!`0$!`0$!`0$!`0$!`0$0!`0$!`0$!`0T
  1638. XM$!`0$!`0$!D9&1D9&1D9&1D0$!`0$!`0DY.3DY.3DY.3DY.3DY.3DY.3DY.3I
  1639. XMDY.3DY,0$!`0$!`S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,Q`0$!`$````Q
  1640. XM`````````````````````````````````````````````````````````````
  1641. XM`````````````````````````````````````````````````````````````
  1642. XM``````````````````````````````````````````````````````$"`P0%/
  1643. XM!@<("0H+#`T.#Q`1$A,4%187&!D:&QP='A\@(2(C)"4F)R@I*BLL+2XO,#$RL
  1644. XM,S0U-C<X.3H[/#T^/T!!0D-$149'2$E*2TQ-3D]045)35%565UA96EM<75Y?5
  1645. XM8$%"0T1%1D=(24I+3$U.3U!14E-455976%E:>WQ]?G^`@8*#A(6&AXB)BHN,^
  1646. XMC8Z/D)&2DY25EI>8F9J;G)V>GZ"AHJ.DI::GJ*FJJZRMKJ^PL;*SM+6VM[BYG
  1647. XMNKN\O;Z_P,'"P\3%QL?(R<K+S,[.S]#1TM/4U=;7V-G:V]S=WM_@X>+CY.7F1
  1648. XMY^CIZNOL[>[O\/'R\_3U]O?X^?K[_/W^_P```````0(#!`4&!P@)"@L,#0X/S
  1649. XM$!$2$Q05%A<8&1H;'!T>'R`A(B,D)28G*"DJ*RPM+B\P,3(S-#4V-S@Y.CL\N
  1650. XM/3X_0&%B8V1E9F=H:6IK;&UN;W!Q<G-T=79W>'EZ6UQ=7E]@86)C9&5F9VAI7
  1651. XM:FML;6YO<'%R<W1U=G=X>7I[?'U^?X"!@H.$A8:'B(F*BXR-CH^0D9*3E)66`
  1652. XMEYB9FIN<G9Z?H*&BHZ2EIJ>HJ:JKK*VNK["QLK.TM;:WN+FZN[R]OK_`P<+#I
  1653. XMQ,7&Q\C)RLO,SL[/T-'2T]35UM?8V=K;W-W>W^#AXN/DY>;GZ.GJZ^SM[N_P3
  1654. XM\?+S]/7V]_CY^OO\_?[_````2.<@`B(()``L;``F3J[_K$S?0`1.=4YQ+PXB<
  1655. XM`"QL`"9.KO^F+%].=4CG(`(B`"0(+&P`)DZN_YI,WT`$3G5.<4CG(`(B`"0(O
  1656. XM+&P`)DZN_Y1,WT`$3G5.<2\.(@`L;``F3J[_@BQ?3G4O#BQL`"9.KO]\+%].Q
  1657. XM=4YQ+PXB`"QL`"9.KO\N+%].=2\.+&P`(DZN_SHL7TYU3G$O#B)(+&P`(DZN>
  1658. XM_RXL7TYU+PXL;``B3J[_"BQ?3G5.<2\.+&P`(DZN_O@L7TYU3G$O#B)(+&P`Y
  1659. XM(DZN_MHL7TYU+PXL;``B3J[^SBQ?3G5.<0```^P````7``````````8````*F
  1660. XM````$@```!H````B````)@```"H````N````,@```#8````Z````<````!8`T
  1661. XM``"*````/@```$(```!&````2@```$X```!2````5@```%H```!>````````(
  1662. X"`_**_
  1663. X``
  1664. Xend
  1665. Xsize 8732
  1666. END_OF_FILE
  1667. if test 12272 -ne `wc -c <'sregexp.uu'`; then
  1668.     echo shar: \"'sregexp.uu'\" unpacked with wrong size!
  1669. fi
  1670. # end of 'sregexp.uu'
  1671. fi
  1672. if test -f 'sregexp_protos.h' -a "${1}" != "-c" ; then 
  1673.   echo shar: Will not clobber existing file \"'sregexp_protos.h'\"
  1674. else
  1675. echo shar: Extracting \"'sregexp_protos.h'\" \(607 characters\)
  1676. sed "s/^X//" >'sregexp_protos.h' <<'END_OF_FILE'
  1677. X
  1678. X#ifndef LIBRARIES_SREGEXPBASE_H
  1679. X#include <libraries/sregexpbase.h>
  1680. X#endif
  1681. X
  1682. Xextern struct SregExpBase *SregExpBase;
  1683. X
  1684. Xextern struct SregExp *     ParseSregExp(char *);
  1685. Xextern void            FreeSregExp(struct SregExp *);
  1686. Xextern int            MatchSregExp(char *, struct SregExp *, int);
  1687. Xextern int            MatchNSregExp(char *, struct SregExp *, int, int);
  1688. Xextern int            IsWild(char *);
  1689. Xextern struct SpathInfo *   AnchorPath(char *, char *);
  1690. Xextern int            NextFile(struct SpathInfo *, char *, int, int);
  1691. Xextern int            BuildPath(struct Spathinf *, char *, int);
  1692. Xextern void            FreeSpathInfo(struct SpathInfo *);
  1693. X
  1694. END_OF_FILE
  1695. if test 607 -ne `wc -c <'sregexp_protos.h'`; then
  1696.     echo shar: \"'sregexp_protos.h'\" unpacked with wrong size!
  1697. fi
  1698. # end of 'sregexp_protos.h'
  1699. fi
  1700. if test -f 'sregexpbase.h' -a "${1}" != "-c" ; then 
  1701.   echo shar: Will not clobber existing file \"'sregexpbase.h'\"
  1702. else
  1703. echo shar: Extracting \"'sregexpbase.h'\" \(3432 characters\)
  1704. sed "s/^X//" >'sregexpbase.h' <<'END_OF_FILE'
  1705. X
  1706. X/*
  1707. X *
  1708. X * sregexpbase.h -- C include file for sregexp.library
  1709. X *
  1710. X * Copyright (C) 1991, Jon Spencer.
  1711. X *
  1712. X * Created: April 20,1991
  1713. X *
  1714. X */
  1715. X
  1716. X#ifndef LIBRARIES_SREGEXPBASE_H
  1717. X#define LIBRARIES_SREGEXPBASE_H
  1718. X
  1719. X#ifndef EXEC_TYPE_H
  1720. X#include <exec/types.h>
  1721. X#endif
  1722. X
  1723. X#ifndef EXEC_LISTS_H
  1724. X#include <exec/lists.h>
  1725. X#endif
  1726. X
  1727. X#ifndef EXEC_LIBRARIES_H
  1728. X#include <exec/libraries.h>
  1729. X#endif
  1730. X
  1731. X#ifndef LIBRARIES_DOS_H
  1732. X#include <libraries/dos.h>
  1733. X#endif
  1734. X
  1735. X
  1736. X/*
  1737. X *
  1738. X * Library base structure, all of these fields are private, and
  1739. X * should not be accessed.
  1740. X *
  1741. X */
  1742. X
  1743. Xstruct SregExpBase {
  1744. X    struct Library  LibNode;
  1745. X    struct Library  *SysBase;
  1746. X    struct Library  *DOSBase;
  1747. X    BPTR        Segment;
  1748. X};
  1749. X
  1750. X#define SREGEXPNAME       "sregexp.library"
  1751. X
  1752. X
  1753. X/*
  1754. X *
  1755. X * Here are the defines for the structures used and returned by
  1756. X * the various sreg functions.    They should probably not be
  1757. X * accessed for there contents, unless you have really good
  1758. X * reason...
  1759. X *
  1760. X */
  1761. X
  1762. Xstruct SregExp {
  1763. X    char            sre_Type,sre_Flag;
  1764. X    SHORT            sre_MinLen;
  1765. X    union {
  1766. X    char    onechar;
  1767. X    char    *setchar;
  1768. X    char    *string;
  1769. X    LONG    number;
  1770. X    }                sre_Data;
  1771. X    struct SregExp *        sre_List[];
  1772. X};
  1773. X
  1774. X
  1775. X/* This is an internal structure for a singly linked list of sregexp's */
  1776. Xstruct SregList {
  1777. X    struct SregExp        *srl_sreg;
  1778. X    struct SregList        *srl_next;
  1779. X};
  1780. X
  1781. X
  1782. X/* various types of wildcard pattern elements.
  1783. X    Goes in struct SregExp.type field */
  1784. X
  1785. X#define SRP_SETCHAR    1
  1786. X#define SRP_ANYCHAR    2
  1787. X#define SRP_ONECHAR    3
  1788. X#define SRP_STRING    4
  1789. X#define SRP_NULL    5
  1790. X#define SRP_OR        6
  1791. X#define SRP_SUM     7
  1792. X
  1793. X
  1794. X
  1795. X/* various flags to mark special properties of patterns.
  1796. X   Goes in struct SregExp.flag */
  1797. X
  1798. X#define SRF_NOT     (1<<0)
  1799. X#define SRF_REPEAT    (1<<1)
  1800. X#define SRF_FIXLEN    (1<<2)
  1801. X#define SRF_JUSTDIRS    (1<<6)    /* special flag used in path matching */
  1802. X#define SRF_RECURSE    (1<<7)    /* dito. */
  1803. X
  1804. X/* defines for the wildcard characters */
  1805. X
  1806. X#define CHR_REPEAT    '#'
  1807. X#define CHR_NOT     '~'
  1808. X#define CHR_OPENBRACE    '('
  1809. X#define CHR_CLOSEBRACE    ')'
  1810. X#define CHR_OPENSET    '['
  1811. X#define CHR_CLOSESET    ']'
  1812. X#define CHR_ANYCHAR    '?'
  1813. X#define CHR_NULL    '%'
  1814. X#define CHR_OR        '|'
  1815. X#define CHR_ESCAPE    '\''
  1816. X#define CHR_RANGE    '-'
  1817. X#define CHR_STAR    '*'
  1818. X
  1819. X
  1820. X
  1821. X
  1822. X/* These are the structures used for the path matching routines. */
  1823. X
  1824. Xstruct SpathInfo {
  1825. X    struct SpathNode *        spi_Head;
  1826. X    struct SpathNode *        spi_Tail;
  1827. X    struct SpathNode *        spi_TailPred;
  1828. X    struct SregList *        spi_SregList;
  1829. X};
  1830. X
  1831. X
  1832. X/* Note: because of the fileinfoblock, this whole structure MUST
  1833. X  be longword aligned. */
  1834. X
  1835. Xstruct SpathNode {
  1836. X    struct SpathNode *        spn_Succ;
  1837. X    struct SpathNode *        spn_Pred;
  1838. X    struct FileInfoBlock    spn_FIB;
  1839. X    BPTR            spn_Lock;
  1840. X    struct SregList *        spn_SregList;
  1841. X    char *            spn_NodeName;
  1842. X    short int            spn_Flags;
  1843. X};
  1844. X
  1845. X/* flags used in spn_Flags, which is  really library private  */
  1846. X#define SPF_DECEND    (1<<0)      /* Should recursively search, when we get the chance. */
  1847. X#define SPF_DONEONCE    (1<<1)      /* Already done it, don't do again */
  1848. X#define SPF_NEXTPARENT    (1<<2)      /* Next one is lock on parentdir */
  1849. X
  1850. X
  1851. X/* These are the possible error returns sent by NextFile and BuildPath */
  1852. X
  1853. X#define SPE_ALL_DONE    -1    /* no more matching files */
  1854. X#define SPE_ERROR    -2    /* some error occured, see IoErr() */
  1855. X#define SPE_BUFF_FULL    -3    /* you didn't give me enough room! */
  1856. X#define SPE_SIGBREAK    -4    /* A control signal came through.  */
  1857. X
  1858. X
  1859. X/* Some defines for what kind of events we match to. */
  1860. X
  1861. X#define SP_DIRS_ONLY    1
  1862. X#define SP_BOTH     0
  1863. X#define SP_FILES_ONLY    -1
  1864. X
  1865. X#endif
  1866. END_OF_FILE
  1867. if test 3432 -ne `wc -c <'sregexpbase.h'`; then
  1868.     echo shar: \"'sregexpbase.h'\" unpacked with wrong size!
  1869. fi
  1870. # end of 'sregexpbase.h'
  1871. fi
  1872. if test -f 'sregexpbase.i' -a "${1}" != "-c" ; then 
  1873.   echo shar: Will not clobber existing file \"'sregexpbase.i'\"
  1874. else
  1875. echo shar: Extracting \"'sregexpbase.i'\" \(3339 characters\)
  1876. sed "s/^X//" >'sregexpbase.i' <<'END_OF_FILE'
  1877. X    IFND        LIBRARIES_SREGEXPBASE_I
  1878. XLIBRARIES_SREGEXPBASE_I set    1
  1879. X
  1880. X*********************************************************************
  1881. X*                                    *
  1882. X* sregbase.i -- asm include file for sreg.library            *
  1883. X*                                    *
  1884. X* Copyright (C) 1991, Jon Spencer.                                  *
  1885. X*                                    *
  1886. X* Created: April 20,1991                        *
  1887. X*                                    *
  1888. X*********************************************************************
  1889. X
  1890. X    IFND        EXEC_TYPES_I
  1891. X    INCLUDE     "exec/types.i"
  1892. X    ENDC
  1893. X
  1894. X    IFND        EXEC_LISTS_I
  1895. X    INCLUDE     "exec/lists.i"
  1896. X    ENDC
  1897. X
  1898. X    IFND        EXEC_LIBRARIES_I
  1899. X    INCLUDE     "exec/libraries.i"
  1900. X    ENDC
  1901. X
  1902. X    IFND        LIBRARIES_DOS_I
  1903. X    INCLUDE     "libraries/dos.i"
  1904. X    ENDC
  1905. X
  1906. X
  1907. X
  1908. X;
  1909. X;
  1910. X; Library base structure, all of these fields are private, and
  1911. X; should not be accessed.
  1912. X;
  1913. X;
  1914. X
  1915. X    STRUCTURE    SregExpBase,LIB_SIZE
  1916. X    APTR        sb_SysBase
  1917. X    APTR        sb_DOSBase
  1918. X    ULONG        sb_SegList
  1919. X    LABEL    SregExpBase_SIZE
  1920. X
  1921. X
  1922. X
  1923. XSREGEXPNAME    macro
  1924. X        dc.b        "sregexp.library",0
  1925. X        endm
  1926. X
  1927. X;
  1928. X;
  1929. X; Here are the equates for the structures used and returned by
  1930. X; the various sreg functions.  They should probably not be
  1931. X; accessed for there contents, unless you have really good
  1932. X; reason...
  1933. X;
  1934. X;
  1935. X    STRUCTURE    SregExp,0
  1936. X    BYTE            sre_Type
  1937. X    BYTE            sre_Flag
  1938. X    SHORT            sre_MinLen
  1939. X    ULONG            sre_Data
  1940. X    APTR            sre_List
  1941. X    LABEL    SregExp_SIZE
  1942. X
  1943. X
  1944. X; sre_Data is a union, here are its elements.
  1945. Xsre_onechar     EQU         sre_Data
  1946. Xsre_setchar     EQU         sre_Data
  1947. Xsre_string     EQU         sre_Data
  1948. Xsre_number     EQU         sre_Data
  1949. X
  1950. X
  1951. X; This is an internal structure for a singly linked list of sregexp's
  1952. X
  1953. X    STRUCTURE    SregList,0
  1954. X    APTR            srl_sreg
  1955. X    APTR            srl_next
  1956. X    LABEL    SregList_SIZE
  1957. X
  1958. X
  1959. X; various types of wildcard pattern elements.  Goes in spat_t.type
  1960. X
  1961. XSRP_SETCHAR  EQU         1
  1962. XSRP_ANYCHAR  EQU         2
  1963. XSRP_ONECHAR  EQU         3
  1964. XSRP_STRING   EQU         4
  1965. XSRP_NULL     EQU         5
  1966. XSRP_OR         EQU         6
  1967. XSRP_SUM      EQU         7
  1968. X
  1969. X; various flags to mark special properties of patterns.
  1970. X; Goes in SregExp.sre_Flag
  1971. X
  1972. X    BITDEF    SR,NOT,0
  1973. X    BITDEF    SR,REPEAT,1
  1974. X    BITDEF    SR,FIXLEN,2
  1975. X    BITDEF    SR,JUSTDIRS,6
  1976. X    BITDEF    SR,RECURSE,7
  1977. X
  1978. X; equates for the wildcard characters
  1979. X
  1980. XCHR_REPEAT    EQU        '#'
  1981. XCHR_NOT     EQU        '~'
  1982. XCHR_OPENBRACE    EQU        '('
  1983. XCHR_CLOSEBRACE    EQU        ')'
  1984. XCHR_OPENSET    EQU        '['
  1985. XCHR_CLOSESET    EQU        ']'
  1986. XCHR_ANYCHAR    EQU        '?'
  1987. XCHR_NULL    EQU        '%'
  1988. XCHR_OR        EQU        '|'
  1989. XCHR_ESCAPE    EQU        "'"
  1990. XCHR_RANGE    EQU        '-'
  1991. XCHR_STAR    EQU        '*'
  1992. X
  1993. X
  1994. X;
  1995. X; These are the structures used for the path matching routines.
  1996. X;
  1997. X
  1998. X    STRUCTURE    SpathInfo,0
  1999. X    APTR        spi_Head
  2000. X    APTR        spi_Tail
  2001. X    APTR        spi_TailPred
  2002. X    APTR        spi_SregList;
  2003. X    LABEL    SpathInfo_SIZE
  2004. X
  2005. X
  2006. X; Note: because of the fileinfoblock, this whole structure MUST
  2007. X; be longword aligned.
  2008. X
  2009. X    STRUCTURE    SpathNode,0
  2010. X    APTR        spn_Succ
  2011. X    APTR        spn_Pred
  2012. X    STRUCT        spn_FIB,fib_SIZEOF
  2013. X    BPTR        spn_Lock
  2014. X    APTR        spn_SregList
  2015. X    APTR        spn_NodeName
  2016. X    SHORT        spn_Flags
  2017. X    LABEL    SpathNode_SIZE
  2018. X
  2019. X; flags used in spn_Flags, which is  really library private.
  2020. X
  2021. X    BITDEF  SP,DECEND,0
  2022. X    BITDEF  SP,DONEONCE,1
  2023. X    BITDEF  SP,NEXTPARENT,2
  2024. X
  2025. X; These are the possible error returns sent by NextFile and BuildPath
  2026. X
  2027. XSPE_ALL_DONE    EQU    -1
  2028. XSPE_ERROR    EQU    -2
  2029. XSPE_BUFF_FULL    EQU    -3
  2030. XSPE_SIGBREAK    EQU    -4
  2031. X
  2032. X
  2033. X; Some defines for what kind of events we match to.
  2034. X
  2035. XSP_DIRS_ONLY    EQU    1
  2036. XSP_BOTH     EQU    0
  2037. XSP_FILES_ONLY    EQU    -1
  2038. X
  2039. X    ENDC
  2040. END_OF_FILE
  2041. if test 3339 -ne `wc -c <'sregexpbase.i'`; then
  2042.     echo shar: \"'sregexpbase.i'\" unpacked with wrong size!
  2043. fi
  2044. # end of 'sregexpbase.i'
  2045. fi
  2046. if test -f 'sregexps.uu' -a "${1}" != "-c" ; then 
  2047.   echo shar: Will not clobber existing file \"'sregexps.uu'\"
  2048. else
  2049. echo shar: Extracting \"'sregexps.uu'\" \(1705 characters\)
  2050. sed "s/^X//" >'sregexps.uu' <<'END_OF_FILE'
  2051. Xbegin 600 sregexps.lib
  2052. XM```#YP````````/H`````````^D````%+PX@;P`(+&P``$ZN_^(L7TYU3G$`<
  2053. XM``/OA@```U]3<F5G17AP0F%S90````$````(`0``!%]087)S95-R96=%>'``Y
  2054. XM`````````````````_(```/G`````````^@````````#Z0````4O#B!O``@L[
  2055. XM;```3J[_W"Q?3G5.<0```^^&```#7U-R96=%>'!"87-E`````0````@!```#P
  2056. XM7T9R9653<F5G17AP``````````````/R```#YP````````/H`````````^D`5
  2057. XM```&+PY,[P,```@@+P`0+&P``$ZN_]8L7TYU```#[X8```-?4W)E9T5X<$)A:
  2058. XM<V4````!````#@$```1?36%T8VA3<F5G17AP``````````````````/R```#N
  2059. XMYP````````/H`````````^D````'+PY,[P,```A,[P`#`!`L;```3J[_T"Q?$
  2060. XM3G5.<0```^^&```#7U-R96=%>'!"87-E`````0```!`!```$7TUA=&-H3E-R*
  2061. XM96=%>'`````````````````#\@```^<````````#Z`````````/I````!2\.Q
  2062. XM(&\`""QL``!.KO_*+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!````5
  2063. XM"`$```)?27-7:6QD```````````````#\@```^<````````#Z`````````/IL
  2064. XM````!2\.3.\#```(+&P``$ZN_\0L7TYU```#[X8```-?4W)E9T5X<$)A<V4``
  2065. XM```!````"@$```-?06YC:&]R4&%T:````````````````_(```/G````````U
  2066. XM`^@````````#Z0````<O#DSO`P``"$SO``,`$"QL``!.KO^^+%].=4YQ```#0
  2067. XM[X8```-?4W)E9T5X<$)A<V4````!````$`$```-?3F5X=$9I;&4`````````C
  2068. XM`````````_(```/G`````````^@````````#Z0````8O#DSO`P``""`O`!`L*
  2069. XM;```3J[_N"Q?3G4```/OA@```U]3<F5G17AP0F%S90````$````.`0```U]"T
  2070. XM=6EL9%!A=&@````````````````#\@```^<````````#Z`````````/I````Q
  2071. XM!2\.(&\`""QL``!.KO^R+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!_
  2072. XM````"`$```1?1G)E95-P871H26YF;P````````````````/R```#YP``````9
  2073. XM``/H`````````^D````````#[P(```5?3%9/1G)E95-P871H26YF;P```/__L
  2074. XM_[("```$7TQ63T)U:6QD4&%T:````/___[@"```#7TQ63TYE>'1&:6QE____J
  2075. XMO@(```1?3%9/06YC:&]R4&%T:```____Q`(```-?3%9/27-7:6QD``#____*E
  2076. XM`@``!5],5D]-871C:$Y3<F5G17AP````____T`(```1?3%9/36%T8VA3<F5GQ
  2077. XM17AP____U@(```1?3%9/1G)E95-R96=%>'``____W`(```1?3%9/4&%R<V533
  2078. X2<F5G17AP____X@````````/R_
  2079. X``
  2080. Xend
  2081. Xsize 1188
  2082. END_OF_FILE
  2083. if test 1705 -ne `wc -c <'sregexps.uu'`; then
  2084.     echo shar: \"'sregexps.uu'\" unpacked with wrong size!
  2085. fi
  2086. # end of 'sregexps.uu'
  2087. fi
  2088. if test -f 'sregexpsr.uu' -a "${1}" != "-c" ; then 
  2089.   echo shar: Will not clobber existing file \"'sregexpsr.uu'\"
  2090. else
  2091. echo shar: Extracting \"'sregexpsr.uu'\" \(1623 characters\)
  2092. sed "s/^X//" >'sregexpsr.uu' <<'END_OF_FILE'
  2093. Xbegin 600 sregexpsr.lib
  2094. XM```#YP````````/H`````````^D````$+PXL;```3J[_XBQ?3G5.<0```^^&\
  2095. XM```#7U-R96=%>'!"87-E`````0````0!```$0%!A<G-E4W)E9T5X<```````>
  2096. XM```````````#\@```^<````````#Z`````````/I````!"\.+&P``$ZN_]PL2
  2097. XM7TYU3G$```/OA@```U]3<F5G17AP0F%S90````$````$`0```T!&<F5E4W)EI
  2098. XM9T5X<``````````````#\@```^<````````#Z`````````/I````!"\.+&P`C
  2099. XM`$ZN_]8L7TYU3G$```/OA@```U]3<F5G17AP0F%S90````$````$`0``!$!-(
  2100. XM871C:%-R96=%>'```````````````````_(```/G`````````^@````````#K
  2101. XMZ0````0O#BQL``!.KO_0+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!N
  2102. XM````!`$```1`36%T8VA.4W)E9T5X<`````````````````/R```#YP``````A
  2103. XM``/H`````````^D````$+PXL;```3J[_RBQ?3G5.<0```^^&```#7U-R96=%R
  2104. XM>'!"87-E`````0````0!```"0$ES5VEL9````````````````_(```/G````6
  2105. XM`````^@````````#Z0````0O#BQL``!.KO_$+%].=4YQ```#[X8```-?4W)E`
  2106. XM9T5X<$)A<V4````!````!`$```-`06YC:&]R4&%T:````````````````_(`U
  2107. XM``/G`````````^@````````#Z0````0O#BQL``!.KO^^+%].=4YQ```#[X8`8
  2108. XM``-?4W)E9T5X<$)A<V4````!````!`$```-`3F5X=$9I;&4`````````````#
  2109. XM`````_(```/G`````````^@````````#Z0````0O#BQL``!.KO^X+%].=4YQ/
  2110. XM```#[X8```-?4W)E9T5X<$)A<V4````!````!`$```-`0G5I;&10871H````9
  2111. XM`````````````_(```/G`````````^@````````#Z0````0O#BQL``!.KO^R\
  2112. XM+%].=4YQ```#[X8```-?4W)E9T5X<$)A<V4````!````!`$```1`1G)E95-PO
  2113. XM871H26YF;P````````````````/R```#YP````````/H`````````^D`````_
  2114. XM```#[P(```5?3%9/1G)E95-P871H26YF;P```/___[("```$7TQ63T)U:6QD,
  2115. XM4&%T:````/___[@"```#7TQ63TYE>'1&:6QE____O@(```1?3%9/06YC:&]RB
  2116. XM4&%T:```____Q`(```-?3%9/27-7:6QD``#____*`@``!5],5D]-871C:$Y3;
  2117. XM<F5G17AP````____T`(```1?3%9/36%T8VA3<F5G17AP____U@(```1?3%9/B
  2118. XM1G)E95-R96=%>'``____W`(```1?3%9/4&%R<V53<F5G17AP____X@``````'
  2119. X#``/RU
  2120. X``
  2121. Xend
  2122. Xsize 1128
  2123. END_OF_FILE
  2124. if test 1623 -ne `wc -c <'sregexpsr.uu'`; then
  2125.     echo shar: \"'sregexpsr.uu'\" unpacked with wrong size!
  2126. fi
  2127. # end of 'sregexpsr.uu'
  2128. fi
  2129. if test ! -d 'utils' ; then
  2130.     echo shar: Creating directory \"'utils'\"
  2131.     mkdir 'utils'
  2132. fi
  2133. if test -f 'utils/bumprev.c' -a "${1}" != "-c" ; then 
  2134.   echo shar: Will not clobber existing file \"'utils/bumprev.c'\"
  2135. else
  2136. echo shar: Extracting \"'utils/bumprev.c'\" \(1133 characters\)
  2137. sed "s/^X//" >'utils/bumprev.c' <<'END_OF_FILE'
  2138. X
  2139. X#include <stdio.h>
  2140. X#include <string.h>
  2141. X#include <ctype.h>
  2142. X#include <stdlib.h>
  2143. X
  2144. Xint
  2145. Xmain(ac,av)
  2146. Xint ac;
  2147. Xchar **av;
  2148. X{
  2149. X    FILE *fp;
  2150. X    int i = 0,r,v,f=0;
  2151. X    char buff[100],*line[100],*p;
  2152. X
  2153. X    if (ac == 2 && strcmp(av[1],"-v") == 0)
  2154. X    f = 1;
  2155. X    if (!(fp = fopen("sreg_version.i","r+"))) {
  2156. X    puts("Unable to open input.");
  2157. X    return 30;
  2158. X    }
  2159. X
  2160. X    while (fgets(buff,100,fp) == buff)
  2161. X    line[i++] = strdup(buff);
  2162. X    line[i] = NULL;
  2163. X
  2164. X    fseek(fp,0,SEEK_SET);
  2165. X    for (i = 0; line[i]; i++) {
  2166. X    if (strncmp(line[i],"VERSION",7) == 0) {
  2167. X        p = line[i];
  2168. X        while (!isdigit(*p)) p++;
  2169. X        v = atoi(p);
  2170. X        if (f) {
  2171. X        v++;
  2172. X        sprintf(p,"%d\n",v);
  2173. X        }
  2174. X    } else
  2175. X    if (strncmp(line[i],"REVISION",8) == 0) {
  2176. X        p = line[i];
  2177. X        while (!isdigit(*p)) p++;
  2178. X        r = atoi(p)+1;
  2179. X        if (f)
  2180. X        r = 0;
  2181. X        sprintf(p,"%d\n",r);
  2182. X    }
  2183. X    fputs(line[i],fp);
  2184. X    }
  2185. X    fclose(fp);
  2186. X    if (!(fp = fopen("sreg_version.c","w"))) {
  2187. X    puts("Unable to open c file.");
  2188. X    return 10;
  2189. X    }
  2190. X    fprintf(fp,
  2191. X"\n\nconst __far char idString[] = \"sreglib %d.%d (\"__DATE__\")\\x0d\\x0a\";\n"
  2192. X,v,r);
  2193. X    fclose(fp);
  2194. X    printf("Up to version %d.%d\n",v,r);
  2195. X    return 0;
  2196. X}
  2197. END_OF_FILE
  2198. if test 1133 -ne `wc -c <'utils/bumprev.c'`; then
  2199.     echo shar: \"'utils/bumprev.c'\" unpacked with wrong size!
  2200. fi
  2201. # end of 'utils/bumprev.c'
  2202. fi
  2203. if test -f 'utils/remlib.c' -a "${1}" != "-c" ; then 
  2204.   echo shar: Will not clobber existing file \"'utils/remlib.c'\"
  2205. else
  2206. echo shar: Extracting \"'utils/remlib.c'\" \(523 characters\)
  2207. sed "s/^X//" >'utils/remlib.c' <<'END_OF_FILE'
  2208. X
  2209. X#include <exec/types.h>
  2210. X#include <exec/libraries.h>
  2211. X#include <clib/exec_protos.h>
  2212. X#include <exec/execbase.h>
  2213. X#include <stdio.h>
  2214. X#include <stdlib.h>
  2215. X
  2216. Xextern struct ExecBase *SysBase;
  2217. X
  2218. Xint
  2219. Xmain(ac,av)
  2220. Xint ac;
  2221. Xchar **av;
  2222. X{
  2223. X    struct Library *found;
  2224. X
  2225. X    if (ac != 2) {
  2226. X    puts("Use: remlib <library name>");
  2227. X    return 10;
  2228. X    }
  2229. X
  2230. X    Forbid();
  2231. X    if (found = (struct Library *)FindName(&SysBase->LibList,av[1]))
  2232. X    RemLibrary(found);
  2233. X    Permit();
  2234. X    if (!found)
  2235. X    return 5;
  2236. X    puts("OK, hopefully it is gone.");
  2237. X    return 0;
  2238. X}
  2239. END_OF_FILE
  2240. if test 523 -ne `wc -c <'utils/remlib.c'`; then
  2241.     echo shar: \"'utils/remlib.c'\" unpacked with wrong size!
  2242. fi
  2243. # end of 'utils/remlib.c'
  2244. fi
  2245. if test -f 'utils/try.c' -a "${1}" != "-c" ; then 
  2246.   echo shar: Will not clobber existing file \"'utils/try.c'\"
  2247. else
  2248. echo shar: Extracting \"'utils/try.c'\" \(1755 characters\)
  2249. sed "s/^X//" >'utils/try.c' <<'END_OF_FILE'
  2250. X
  2251. X#include "sregexpbase.h"
  2252. X#include "sregexp_protos.h"
  2253. X#include <libraries/dos.h>
  2254. X#include <clib/exec_protos.h>
  2255. X#include <clib/dos_protos.h>
  2256. X#include <string.h>
  2257. X#include <assert.h>
  2258. X#include <stdlib.h>
  2259. X
  2260. Xstruct SregExpBase *SregExpBase;
  2261. X
  2262. Xvoid
  2263. Xputs(c)
  2264. Xchar *c;
  2265. X{
  2266. Xchkabort();
  2267. X    Write(Output(),c,strlen(c));
  2268. X    Write(Output(),"\n",1);
  2269. X}
  2270. X
  2271. X#include <stdarg.h>
  2272. X
  2273. Xextern void vsprintf(char *, char *, va_list);
  2274. X
  2275. Xvoid printf(f, ...)
  2276. Xchar *f;
  2277. X{
  2278. X    char buff[100];
  2279. X    va_list va;
  2280. X
  2281. Xchkabort();
  2282. X    va_start(va,f);
  2283. X    vsprintf(buff,f,va);
  2284. X    va_end(va);
  2285. X    Write(Output(),buff,strlen(buff));
  2286. X}
  2287. X
  2288. Xint
  2289. Xbrk()
  2290. X{  /* Don't worry about lost memory for now... */
  2291. X
  2292. XWrite(Output(),"BREAK\n",6);
  2293. X    CloseLibrary(SregExpBase);
  2294. X    return 1;
  2295. X
  2296. X}
  2297. X
  2298. Xint
  2299. Xmain(ac,av)
  2300. Xint ac;
  2301. Xchar *av;
  2302. X{
  2303. X    struct SregExp *pat;
  2304. X    struct SpathInfo *spi;
  2305. X    char buff[300],fb[110];
  2306. X    BPTR    lock;
  2307. X
  2308. X    if (!(SregExpBase = OpenLibrary("sregexp.library",0))) {
  2309. X    puts("Unable to open library.");
  2310. X    return 5;
  2311. X    }
  2312. X    onbreak(brk);
  2313. X/*
  2314. X    assert(pat = ParseSregExp("#?dog"));
  2315. X
  2316. X    if (MatchSregExp("hello dog",pat,1))
  2317. X    puts("right");
  2318. X    else
  2319. X    puts("wrong");
  2320. X
  2321. X    if (MatchSregExp("hello Dog",pat,1))
  2322. X    puts("right");
  2323. X    else
  2324. X    puts("wrong");
  2325. X
  2326. X    if (MatchSregExp("hello Dog",pat,0))
  2327. X    puts("right");
  2328. X    else
  2329. X    puts("wrong");
  2330. X
  2331. X    if (MatchSregExp("hello cat",pat,1))
  2332. X    puts("right");
  2333. X    else
  2334. X    puts("wrong");
  2335. X
  2336. X    FreeSregExp(pat);
  2337. X*/
  2338. X    assert(pat = ParseSregExp("(Programs|Shell)"));
  2339. X
  2340. X    if (!(spi = AnchorPath("","DCC:#?/dme.refs"))) {
  2341. X    puts("Couldn't start search.");
  2342. X    CloseLibrary(SregExpBase);
  2343. X    return 10;
  2344. X    }
  2345. Xputs("Path anchored");
  2346. X    while (NextFile(spi,buff,300,0) != SPE_ALL_DONE) {
  2347. X    printf("----------> %s\n",buff);
  2348. X    }
  2349. X
  2350. X    FreeSpathInfo(spi);
  2351. X
  2352. X    CloseLibrary(SregExpBase);
  2353. X}
  2354. END_OF_FILE
  2355. if test 1755 -ne `wc -c <'utils/try.c'`; then
  2356.     echo shar: \"'utils/try.c'\" unpacked with wrong size!
  2357. fi
  2358. # end of 'utils/try.c'
  2359. fi
  2360. echo shar: End of archive 1 \(of 2\).
  2361. cp /dev/null ark1isdone
  2362. MISSING=""
  2363. for I in 1 2 ; do
  2364.     if test ! -f ark${I}isdone ; then
  2365.     MISSING="${MISSING} ${I}"
  2366.     fi
  2367. done
  2368. if test "${MISSING}" = "" ; then
  2369.     echo You have unpacked both archives.
  2370.     rm -f ark[1-9]isdone
  2371. else
  2372.     echo You still need to unpack the following archives:
  2373.     echo "        " ${MISSING}
  2374. fi
  2375. ##  End of shell archive.
  2376. exit 0
  2377. -- 
  2378. Mail submissions (sources or binaries) to <amiga@uunet.uu.net>.
  2379. Mail comments to the moderator at <amiga-request@uunet.uu.net>.
  2380. Post requests for sources, and general discussion to comp.sys.amiga.misc.
  2381.